Guide for incorporating the ADK in my UI #3258
Replies: 1 comment
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: The recommended way to integrate the ADK with a custom UI is to create a backend that uses Hello! Thank you for your question. Here’s a guide on how to approach integrating the ADK into your custom UI, covering the points you raised. Managing Conversation Turns and EventsThe core of the interaction between a UI and the ADK is managed through a stream of A key part of handling this stream in your UI is to identify the final response for a given turn. The Here is a basic example of how you would process events from the runner: from adk.api import Session, new_message
async def process_user_request(session: Session, user_input: str):
# Add the user's message to the session
session.add(new_message(user_input))
# Run the agent and process the stream of events
async for event in session.runner.run_async():
print(f"Received event: {event.content}")
# Check if this is the final event for the turn
if event.is_final_response():
print("Agent's turn is complete.")
# You can now update the UI to indicate the turn is over
breakConversations are tracked using a Building a Custom UIWhile you can build a UI from scratch, we provide tools to make this much easier, especially for web-based interfaces.
Listing AgentsThe ADK framework discovers agents based on a specific directory structure. When you run The You can also structure agents into teams or hierarchies by defining a parent agent and passing other agents to its We hope this guidance helps you get started! [1] ADK Events |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a guide on how best to integrate the ADK in my own UI, such as the best way to list agents, look for events and manage conversation turns?
Beta Was this translation helpful? Give feedback.
All reactions