Skip to content

docs(callbacks): align Python callback contracts with runtime - #2207

Open
jaywang172 wants to merge 1 commit into
google:mainfrom
jaywang172:docs/callback-contracts
Open

docs(callbacks): align Python callback contracts with runtime#2207
jaywang172 wants to merge 1 commit into
google:mainfrom
jaywang172:docs/callback-contracts

Conversation

@jaywang172

@jaywang172 jaywang172 commented Sep 5, 2026

Copy link
Copy Markdown

Summary

Companion API docstrings: google/adk-python#7022

The Python callback guide currently says renamed parameters always fail and
that before/after tool callbacks stop only on truthy values. Current ADK Python
supports positional fallback and stops tool callback lists on non-None
responses, including {}.

Update the existing Python notes to describe keyword-first binding and
canonical positional fallback, with examples showing that renamed keyword-only
parameters still fail. Replace the stopping-rule paragraph with a table of
response types and conditions for all eight agent-defined hooks. Clarify when
an empty tool response skips execution, replaces a result, or handles an error;
model error recovery requires LlmResponse.

Also correct the before-tool note that still says an empty dictionary lets
later callbacks run, and make the corresponding after-tool behavior explicit.

The changes are scoped to Python agent-defined callbacks and link to the
separate plugin rules. Generated API reference files are untouched.

Validation

  • mkdocs build --strict: passed, including the Pagefind index (233 pages).
  • Executed all four signature examples against adk-python 0b75a66d: the three
    supported signatures work and the renamed keyword-only signature raises
    TypeError.
  • 214 existing callback-related tests passed on the companion adk-python
    documentation branch.
  • git diff --check: passed.
  • Previewed the guide locally with mkdocs serve and in a browser, including
    the expanded signature examples, both tables, and the before/after-tool notes.

The strict build reports two existing INFO-level missing-anchor diagnostics in
the unchanged live guides; it exits successfully with no build warnings/errors.

@netlify

netlify Bot commented Sep 5, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit a7d3f36
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a9b767f77d654000898bc2a
😎 Deploy Preview https://deploy-preview-2207--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