docs(agents): fix broken agent snippets and stale API claims - #2021
Open
GWeale wants to merge 2 commits into
Open
docs(agents): fix broken agent snippets and stale API claims#2021GWeale wants to merge 2 commits into
GWeale wants to merge 2 commits into
Conversation
✅ Deploy Preview for adk-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.md—create_session()was shown as a plain synchronous call; it's async, so the example now wraps it inasyncio.run(...). Two planner examples omitted the requirednameonAgent(...). An instruction example embedded{country}, which ADK treats as a state-injection placeholder, so it's now a literal country. Also:modelis optional in Python (inherits from the nearest ancestor, else the built-in default),global_instructionis deprecated in favor ofGlobalInstructionPlugin,input_schemaapplies when the agent is invoked as a tool rather than to direct user messages,generate_content_configraisesValueErrorif it setstools/system_instruction/response_schema, andoutput_schemais no longer described as incompatible withtools.docs/agents/custom-agents.md— the "agent as a tool" snippet usedEventandtypeswithout importing them, and calledtypes.Part.from_bytespositionally when its arguments are keyword-only; both fixed. Adds thatBaseAgentis a Pydantic model withextra='forbid', so sub-agents must be declared as annotated fields rather than assigned in__init__, and that live runs need_run_live_implor raiseNotImplementedError.docs/agents/workflow-agents/index.md,sequential-agents.md,parallel-agents.md,loop-agents.md—SequentialAgent,ParallelAgentandLoopAgentnow emit aDeprecationWarningon construction; each page says so. Fixes a broken##data-handlinganchor (double#).docs/agents/workflow-agents/loop-agents.md—max_iterationswas implied to be set by default; it defaults toNone, so the loop only stops on escalation. Termination was described vaguely ("return a STOP signal"); it's now the concrete mechanism — an event withactions=EventActions(escalate=True),ctx.actions.escalate, or the built-inexit_looptool.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 sharedInvocationContextand use locks" advice is replaced withoutput_keyplus a warning not to read a key another branch is still writing.docs/agents/managed-agents.md— the persisted event value isinteraction_id, notprevious_interaction_id, and it's sent back to the backend rather than reused locally. "MCP tools are not supported" was too broad: rawtypes.Tool.mcp_serversconfigs raiseNotImplementedError, but server-sideRemoteMcpServerspecs work. Addsmode='single_turn'and the newer samples.docs/agents/config.md— "only Gemini models are supported" applied to the whole feature; the restriction is on themodel:key. Other models go throughmodel_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-pythonv2.5.0 source: every import resolved against a real 2.5.0 install, every constructor kwarg checked againstmodel_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 --strictis 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.