tools-and-integrations
Bind and troubleshoot ADK Python tools, ToolContext, long-running and confirmation tools, auth, MCP/OpenAPI/Google API/cloud integrations, A2A helpers, and optional extras.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- tools-and-integrations
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Bind and troubleshoot ADK Python tools, ToolContext, long-running and confirmation tools, auth, MCP/OpenAPI/Google API/cloud integrations, A2A helpers, and optional extras.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md17.2 KB
- 参考文档references/troubleshooting.md11.2 KB
- 参考文档references/workflows.md16.7 KB
- 脚本scripts/inspect_tooling.py8.6 KB
03 SKILL.md 正文
ADK Tools and Integrations
Use this sub-skill when a user asks to add, wrap, authenticate, expose, or debug tools and integration toolsets in an ADK Python agent.
Route Here
- Bind Python functions with
FunctionTool,LongRunningFunctionTool,ToolContext,request_input, or explicittool_context.request_confirmation(). - Build custom
BaseToolorBaseToolsetclasses, filter/prefix toolsets, or close toolset resources safely. - Wrap agents as tools with
AgentTool, delegate withTransferToAgentToolortransfer_to_agent, or diagnose tool-name routing issues. - Add auth with
AuthConfig,AuthCredential,AuthenticatedFunctionTool, OpenAPI auth helpers, MCP auth, or credential request flows. - Configure MCP, OpenAPI, API Hub, Google API, Application Integration, BigQuery/Bigtable/Spanner/Pub/Sub/Data Agent/Toolbox/Slack/A2A integrations.
- Diagnose missing optional extras such as
google-adk[mcp],google-adk[extensions],google-adk[gcp],google-adk[tools],google-adk[a2a],google-adk[toolbox], orgoogle-adk[db].
Route Elsewhere
- Agent constructor field placement,
model,instruction, schemas, and callback basics: useagent-construction. - CLI command usage, app discovery, local servers, deployment, and YAML config loading: use
cli-configuration-deployment. Runner,App, session/memory/artifact persistence, plugins, telemetry, and service lifecycles: useruntime-services.- Workflow graph nodes,
Workflow, HITL node resume, joins, and dynamic graph routing: useworkflow-orchestration. - Modifying ADK repository source, style, tests, docs, or samples: use
repo-development.
Quick Start
- Prefer bare callables for simple tools; wrap with
FunctionTool(func=..., require_confirmation=...)only when you need confirmation or explicit tool object behavior. - Add
tool_context: ToolContextonly when the tool needs state, artifacts, credentials, confirmation, transfer actions, or workflow node helpers; the parameter must be namedtool_context. - Return JSON-serializable dictionaries for structured tool results; return
{"error": "..."}when the model should see a recoverable tool failure. - Use
LongRunningFunctionToolfor work that returns pending status or pauses for external input; do not retry the same long-running call unless the returned event requests it. - Treat MCP, cloud, database, and A2A helpers as optional-extra surfaces; first run the bundled inspection script before assuming an import is available.
from google.adk import Agent
from google.adk.tools import FunctionTool, ToolContext
def transfer_funds(amount: float, recipient: str, tool_context: ToolContext):
"""Transfer funds after ADK collects confirmation."""
return {"status": "scheduled", "amount": amount, "recipient": recipient}
root_agent = Agent(
name="finance_agent",
model="gemini-3.5-flash",
instruction="Use tools for account operations and explain the result.",
tools=[FunctionTool(func=transfer_funds, require_confirmation=True)],
)
References
- API reference — public classes, constructors, auth models, tool context methods, integration toolset families, optional extras, and local validation checks.
- Workflows — recipes for function tools, confirmation, long-running tools, MCP, OpenAPI, Google API/cloud integrations, A2A exposure, and safe fallback planning.
- Troubleshooting — fixes for missing extras, credentials, auth config, schema conversion, MCP sessions, cloud clients, confirmation confusion, and swallowed tool errors.
- Inspection script — no-network diagnostic that prints installed tool signatures and reports optional-extra availability without failing the whole run.
Tooling Checklist
- Tool names are stable, unique, and derived from clear function/class names; descriptions come from docstrings or explicit
BaseTooldescriptions. - Function parameters are typed with JSON-schema-friendly types; Pydantic models are accepted for structured arguments but should be validated before side effects.
ToolContextis used for state, credentials, confirmation, memory/artifacts, transfer actions, or node execution; it is not exposed to the model as a normal argument.- Sensitive operations require either
require_confirmation=Trueor explicittool_context.request_confirmation()handling. - Integration code documents which extra and which credential source are required, and includes a local import/help probe before any network or credential-dependent call.
- Tool exceptions are either intentionally propagated or translated by
on_tool_error_callback; recoverable domain failures return a function response such as{"error": "..."}.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).