backend_feedback.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your OpenAI API key
4
Run the example
Save the code above as
backend_feedback.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Frontend-provided tool: get_user_choice (via useHumanInTheLoop).
"""
Backend Feedback — Dojo Demo
============================
Frontend-provided tool: get_user_choice (via useHumanInTheLoop)
The frontend defines this tool for presenting multiple choices to the user.
When called, it renders a card with radio buttons for selection.
"""
from agno.agent.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
backend_feedback_agent = Agent(
name="backend_feedback",
model=OpenAIResponses(id="gpt-5.5"),
db=SqliteDb(db_file="/tmp/agui_backend_feedback.db"),
instructions="""You are an assistant that helps users make decisions.
When you need the user to choose from options:
- Call get_user_choice with: question, options (array of strings)
- Wait for user to select an option
Example get_user_choice call:
{
"question": "What type of cuisine would you prefer for dinner?",
"options": ["Italian", "Japanese", "Mexican", "Indian", "Thai"]
}
After receiving the selection:
- Acknowledge their choice
- Provide relevant recommendations or next steps based on their selection
- Ask follow-up questions if needed using get_user_choice again""",
markdown=True,
)
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno openai sqlalchemy
Export your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
Run the example
backend_feedback.py, then run:python backend_feedback.py
Was this page helpful?