mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
32 lines
1006 B
Plaintext
32 lines
1006 B
Plaintext
<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>
|
|
<Step>
|
|
### Stop after the final model response
|
|
|
|
The agent above imports `stop_on_terminal_text` and registers it as its
|
|
`after_model_callback`. This prevents Gemini from issuing the same tool
|
|
call again after its final text response. See the canonical
|
|
[`stop_on_terminal_text` implementation](https://github.com/CopilotKit/CopilotKit/blob/main/showcase/integrations/google-adk/src/agents/shared_chat.py)
|
|
when adapting the callback for your project.
|
|
|
|
</Step>
|
|
</Steps>
|