Files
Ben Taylor 7a36707ab1 fix(docs): document the ADK agent context state key (#7070)
## Problem

The documentation does not clearly establish the Google ADK agent-side
path for `useAgentContext`. The hook reference points generically to
integration guides, while the existing ADK setup uses
`state["copilotkit"]["context"]`, which is not where the adapter stores
the AG-UI request context.

## Why

Reproduced using the actual adapter and ADK Runner with an instruction
provider and a deterministic local model. Given
`RunAgentInput.context=[{description: "Incident records", value:
"[{\"id\":\"INC-1041\"}]"}]` and empty request state:

```text
state["copilotkit"]["context"]: []
state[CONTEXT_STATE_KEY] (_ag_ui_context):
  [{"description": "Incident records", "value": "[{\"id\":\"INC-1041\"}]"}]
```

## Fix

Document the public `CONTEXT_STATE_KEY` export in the hook reference and
link directly to the ADK context guide. Replace that guide's setup with
a standalone instruction-provider example using the correct state key.
Preserve the Gemini final-text termination safeguard with a fully
defined callback in the same example. Explain the string values, parsing
structured values, callback/tool access, and the distinction between
exposing frontend tools and including context in model instructions.

Validation: regenerated the setup-content bundle through Nx, extracted
and executed its Python example, and drove the documented instruction
provider through the real adapter/Runner. It delivered `INC-1041` into
the model request's system instruction and completed with text events
and `RUN_FINISHED`. This is a deterministic integration reproduction,
not a live Gemini/browser test. `git diff --check` passes.

Targeted shell-docs checks: **26 passed across 3 files**
(`setup-content`, `setup-concept`, and `frontend-tools-setup-coverage`),
run through Nx after generating the normal docs prerequisites.

The context example also passes nine copied-code callback checks
(registration, final text, partial/thinking output, tool calls, and
private-context compatibility). The bundled context-to-model execution
check and 26 targeted docs tests pass after this correction.
2026-09-10 23:20:44 -05:00
..