AGENT SKILL

agent-construction

Build and troubleshoot ADK Python Agent/LlmAgent definitions, model settings, modes, callbacks, schemas, and multi-agent delegation.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
agent-construction
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Build and troubleshoot ADK Python Agent/LlmAgent definitions, model settings, modes, callbacks, schemas, and multi-agent delegation.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

ADK Python Agent Construction

Use this sub-skill when a user asks to define, revise, or debug Python ADK agents built with google.adk.Agent or google.adk.agents.LlmAgent.

Route Here

  • Create a minimal root_agent, add model, instruction, description, tools, callbacks, or schemas.
  • Choose between mode="chat", mode="task", and mode="single_turn" for LLM agents and sub-agents.
  • Build hierarchical multi-agent systems with sub_agents, delegation descriptions, task agents, or single_turn helper agents.
  • Add structured input/output with Pydantic schemas, output_schema, input_schema, and output_key.
  • Diagnose constructor validation errors, missing model credentials, callback ordering, schema/tool interactions, and sub-agent context isolation.

Route Elsewhere

  • Workflow graph nodes, Workflow, BaseNode, graph edges, dynamic nodes, joins, and workflow HITL: use workflow-orchestration.
  • ADK CLI commands, YAML app loading, adk run, adk web, deployment, and config schema generation: use cli-configuration-deployment.
  • Tool internals, toolsets, MCP/OpenAPI/Google API tools, auth flows, and optional integration extras: use tools-and-integrations.
  • Runner services, sessions, memory, artifacts, plugins, telemetry, and code executors: use runtime-services.
  • Modifying the ADK source repository itself, style, focused tests, docs, or samples: use repo-development.

Quick Start

  1. Import from the public package: from google.adk import Agent or from google.adk.agents import LlmAgent, RunConfig.
  2. Name agents with valid Python identifiers; never use user as an agent name.
  3. Put model behavior in instruction, static generation options in generate_content_config, tools in tools, and final response schemas in output_schema.
  4. Expose a Python app by defining root_agent = Agent(...) in an importable module.
  5. Use a Runner only after selecting runtime services and creating or auto-creating sessions; this sub-skill focuses on the agent definitions.
from google.adk import Agent


def get_weather(city: str) -> str:
  """Return a simple weather summary."""
  return f"Weather for {city}: sunny."


root_agent = Agent(
    name="weather_agent",
    model="gemini-3.5-flash",
    instruction="Answer weather questions and call tools when needed.",
    tools=[get_weather],
)

References

  • API reference — constructor fields, imports, validation rules, callbacks, schemas, RunConfig, and Runner.run invocation shape.
  • Workflows — recipes for minimal agents, sample app layout, callbacks, structured output, task and single_turn sub-agents, and multi-agent delegation.
  • Troubleshooting — fixes for generation config errors, schema/tool behavior, model credentials, branch isolation, callback order, and tool error callbacks.
  • Inspection script — safe local diagnostic that prints installed ADK signatures and constructs a no-network minimal agent.

Agent-Construction Checklist

  • Agent tree has unique, identifier-safe names and clear one-line description strings for delegatable sub-agents.
  • Root LlmAgent runs in chat mode; task and single_turn are usually child agents exposed to the parent as tools.
  • output_schema is used for final structured responses; generate_content_config.response_schema is not used on LlmAgent.
  • Tool callables have docstrings and typed parameters; deeper toolset/auth issues route to tools-and-integrations.
  • Callback functions return None to continue, or the documented override shape to short-circuit or replace model/tool behavior.
  • Model/provider credentials and optional extras are treated as deployment assumptions, not as requirements for constructing an in-memory agent object.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351