Skip to content

docs(context): fix broken samples and stale API claims in context pages - #2024

Open
GWeale wants to merge 3 commits into
google:mainfrom
GWeale:docs-audit-context
Open

docs(context): fix broken samples and stale API claims in context pages#2024
GWeale wants to merge 3 commits into
google:mainfrom
GWeale:docs-audit-context

Conversation

@GWeale

@GWeale GWeale commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Audit of the three docs/context/ pages: a Python sample that doesn't parse, an attribute that no longer exists in 2.5.0, async methods documented as synchronous, and config fields/constraints that didn't match the code.

Changes

  • docs/context/compaction.md — the EventsCompactionConfig(...) sample was missing its closing paren, so it was a syntax error; added it. Counting is per invocation, not per event, so the prose, the worked example and the field descriptions now say "invocation". Also notes that sliding-window compaction runs in the Runner after each invocation (only token-based compaction runs in SingleFlow), that the App must be passed to Runner(app=app, ...) for compaction to take effect, and that compaction_interval must be > 0 and set together with overlap_size.
  • docs/context/index.mdevent.stringify_content() is not an attribute; now event.content. search_memory returns .memories (MemoryEntry objects), not .results with .text. save_artifact / load_artifact / list_artifacts / search_memory are async, so those samples now await from async def. types.Part.from_text needs the keyword text=. Event(content=...) takes a types.Content, not a str. Imports simplified to from google.adk.agents import Context / InvocationContext. The model-callback sample uses the parameter names the framework passes by keyword and returns Optional[LlmResponse]. CallbackContext and ToolContext are described as aliases of Context, with the tool-only members called out. end_invocation stops the agent that sets it (and the whole cycle only when that agent is root); callbacks and tools cannot set it.
  • docs/context/caching.md — the create_http_options field was undocumented; added, with the ttl_seconds > 0 and cache_intervals 1–100 constraints, the fact that min_tokens is compared against the previous request's prompt token count (so the first request is never cached), Gemini's own minimum cacheable size, and an experimental banner for ContextCacheConfig.

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 cabdffb
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a6a999476d46000089576a0
😎 Deploy Preview https://deploy-preview-2024--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