chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:58:18 +08:00
commit 6d5d58c1a9
18293 changed files with 3502153 additions and 0 deletions
@@ -0,0 +1,21 @@
<Steps>
<Step>
### Install the ADK + AG-UI bridge
```bash
pip install ag-ui-adk
```
</Step>
<Step>
### Add `AGUIToolset()` to your agent
Agent config flows from the UI through `useAgentContext`. With
`AGUIToolset()` wired into your `LlmAgent`, the context entry is
available in session state on every turn — read it inside a
`before_model_callback` to inject preferences into the system prompt.
<DemoCode file="src/agents/agent_config_agent.py" region="agent-config-setup" />
</Step>
</Steps>
@@ -0,0 +1,21 @@
<Steps>
<Step>
### Install the ADK + AG-UI bridge
```bash
pip install ag-ui-adk
```
</Step>
<Step>
### Read CopilotKit context before each model call
`useAgentContext` entries arrive in ADK session state under
`state["copilotkit"]["context"]`. Add `AGUIToolset()` to the agent and
use a `before_model_callback` to inject those read-only values into the
system instruction.
<DemoCode file="src/agents/readonly_state_agent_context_agent.py" region="agent-context-setup" />
</Step>
</Steps>
@@ -0,0 +1,19 @@
First, pass `AGUIToolset()` in your `LlmAgent`'s `tools=` list and pair it
with `stop_on_terminal_text` as the `after_model_callback`. The toolset is
what makes every CopilotKit feature on the frontend — frontend tools, shared
state, agent context, and generative UI components — visible to your ADK
agent on every turn.
<DemoCode file="src/agents/hitl_in_chat_agent.py" region="setup" />
<Accordions>
<Accordion title="Install the SDK">
If `ag-ui-adk` isn't already in your project, add it so the imports
above resolve:
```bash
pip install ag-ui-adk
```
</Accordion>
</Accordions>
@@ -0,0 +1,22 @@
<Steps>
<Step>
### Install the ADK + AG-UI bridge
```bash
pip install ag-ui-adk
```
</Step>
<Step>
### Add `AGUIToolset()` to your agent
`AGUIToolset()` is the tool that exposes CopilotKit's frontend-tool
channel to the model — drop it into your `LlmAgent`'s `tools=` list and
frontend tools become available on every turn. Pair it with
`stop_on_terminal_text` as the `after_model_callback` so CopilotKit's UI
knows when the agent has finished its turn.
<DemoCode file="src/agents/hitl_in_chat_agent.py" region="setup" />
</Step>
</Steps>
@@ -0,0 +1,22 @@
<Steps>
<Step>
### Install the ADK + AG-UI bridge
```bash
pip install ag-ui-adk
```
</Step>
<Step>
### Add `AGUIToolset()` to your agent
Tool-based HITL (`useHumanInTheLoop`) registers the picker UI on the
frontend; CopilotKit forwards the tool definition to your model through
`AGUIToolset()`. ADK doesn't have a native `interrupt(...)` primitive
like LangGraph — for graph-paused pauses, use the frontend
Promise-based `useFrontendTool` pattern instead.
<DemoCode file="src/agents/hitl_in_chat_agent.py" region="setup" />
</Step>
</Steps>
@@ -0,0 +1,25 @@
<Steps>
<Step>
### Install the ADK + AG-UI bridge
```bash
pip install ag-ui-adk
```
</Step>
<Step>
### Add `AGUIToolset()` to your agent
Programmatic control (`copilotkit.runAgent`, `agent.subscribe`,
`agent.addMessage`) drives runs through the same agent your chat UI
uses, so the backend wiring is the same — wire `AGUIToolset()` once and
every entry point sees the same forwarded tools and state.
<DemoCode file="src/agents/hitl_in_chat_agent.py" region="setup" />
ADK doesn't ship a native `interrupt(...)` primitive — for the headless
interrupt-resolver pattern, use the frontend `useFrontendTool`
Promise-based handler instead.
</Step>
</Steps>
@@ -0,0 +1,24 @@
<Steps>
<Step>
### Install the ADK + AG-UI bridge
```bash
pip install ag-ui-adk
```
</Step>
<Step>
### Add `AGUIToolset()` to your agent
Shared state in ADK lives in `tool_context.state` — your tools write to
it directly and the runtime forwards updates to the UI. Wire your
`LlmAgent` with `AGUIToolset()` and CopilotKit takes care of the rest.
<DemoCode file="src/agents/shared_state_read_write_agent.py" region="shared-state-setup" />
See `src/agents/shared_state_read_write_agent.py` for the bidirectional
pattern: a before-model callback reads UI-authored preferences out of
session state, and a `set_notes` tool writes agent-authored notes back.
</Step>
</Steps>
@@ -0,0 +1,21 @@
<Steps>
<Step>
### Install the ADK + AG-UI bridge
```bash
pip install ag-ui-adk
```
</Step>
<Step>
### Declare the predicted state mapping
ADK state streaming uses `PredictStateMapping` to map the streaming
`write_document` tool argument into `state["document"]`. Add
`AGUIToolset()` to the agent so CopilotKit can forward the state deltas to
the UI.
<DemoCode file="src/agents/shared_state_streaming_agent.py" region="state-streaming-middleware" />
</Step>
</Steps>
@@ -0,0 +1,25 @@
<Steps>
<Step>
### Install the ADK + AG-UI bridge
```bash
pip install ag-ui-adk
```
</Step>
<Step>
### Add `AGUIToolset()` to your supervisor agent
Sub-agents are tools on a supervisor `LlmAgent`. The showcase uses
`google.genai.Client.models.generate_content` for each sub-agent call —
much lighter than spawning a separate `LlmAgent` + `Runner` per
delegation. Delegation events are written to `tool_context.state` and
flow back to the UI through CopilotKit's shared-state channel.
<DemoCode file="src/agents/subagents_agent.py" region="subagent-setup" />
See `src/agents/subagents_agent.py` for the supervisor + three
sub-agents pattern with a live delegation log.
</Step>
</Steps>