Skip to content

docs(agents): fix broken agent snippets and stale API claims - #2021

Open
GWeale wants to merge 2 commits into
google:mainfrom
GWeale:docs-audit-agents-core
Open

docs(agents): fix broken agent snippets and stale API claims#2021
GWeale wants to merge 2 commits into
google:mainfrom
GWeale:docs-audit-agents-core

Conversation

@GWeale

@GWeale GWeale commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Corrections to the core agent pages (docs/agents/): snippets that don't run as written, plus behavioral claims that no longer match Python v2.5.0.

Changes

  • docs/agents/llm-agents.mdcreate_session() was shown as a plain synchronous call; it's async, so the example now wraps it in asyncio.run(...). Two planner examples omitted the required name on Agent(...). An instruction example embedded {country}, which ADK treats as a state-injection placeholder, so it's now a literal country. Also: model is optional in Python (inherits from the nearest ancestor, else the built-in default), global_instruction is deprecated in favor of GlobalInstructionPlugin, input_schema applies when the agent is invoked as a tool rather than to direct user messages, generate_content_config raises ValueError if it sets tools/system_instruction/response_schema, and output_schema is no longer described as incompatible with tools.
  • docs/agents/custom-agents.md — the "agent as a tool" snippet used Event and types without importing them, and called types.Part.from_bytes positionally when its arguments are keyword-only; both fixed. Adds that BaseAgent is a Pydantic model with extra='forbid', so sub-agents must be declared as annotated fields rather than assigned in __init__, and that live runs need _run_live_impl or raise NotImplementedError.
  • docs/agents/workflow-agents/index.md, sequential-agents.md, parallel-agents.md, loop-agents.mdSequentialAgent, ParallelAgent and LoopAgent now emit a DeprecationWarning on construction; each page says so. Fixes a broken ##data-handling anchor (double #).
  • docs/agents/workflow-agents/loop-agents.mdmax_iterations was implied to be set by default; it defaults to None, so the loop only stops on escalation. Termination was described vaguely ("return a STOP signal"); it's now the concrete mechanism — an event with actions=EventActions(escalate=True), ctx.actions.escalate, or the built-in exit_loop tool.
  • docs/agents/workflow-agents/parallel-agents.md — said there is no state sharing between branches. Only conversation history is branch-local; session state is shared, so the "pass a shared InvocationContext and use locks" advice is replaced with output_key plus a warning not to read a key another branch is still writing.
  • docs/agents/managed-agents.md — the persisted event value is interaction_id, not previous_interaction_id, and it's sent back to the backend rather than reused locally. "MCP tools are not supported" was too broad: raw types.Tool.mcp_servers configs raise NotImplementedError, but server-side RemoteMcpServer specs work. Adds mode='single_turn' and the newer samples.
  • docs/agents/config.md — "only Gemini models are supported" applied to the whole feature; the restriction is on the model: key. Other models go through model_code:, and the two keys are mutually exclusive.

How this was produced

Part of a page-by-page audit of the Python docs against the google/adk-python v2.5.0 source: every import resolved against a real 2.5.0 install, every constructor kwarg checked against model_fields / inspect.signature, every documented default read off the field. A second independent pass re-derived each claim from source rather than trusting the finding, and a third conformed the new wording to the surrounding pages. mkdocs build --strict is clean.

Only Python tabs and language-neutral prose were touched — this audit had no ground truth for the Go / Java / TypeScript SDKs.

Split out of a larger audit branch so each area can be reviewed on its own.

@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit 0c2ed1e
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a6a998f7c9a04000897fd7e
😎 Deploy Preview https://deploy-preview-2021--adk-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant