hitl_user_input.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
hitl_user_input.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Minimal backend agent with frontend-defined tools via useHumanInTheLoop.
"""
HITL User Input
===============
Minimal backend agent with frontend-defined tools via useHumanInTheLoop.
"""
from agno.agent.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS
from agno.os.interfaces.agui import AGUI
user_input_agent = Agent(
name="user_input",
model=OpenAIResponses(id="gpt-5.5"),
db=SqliteDb(db_file="/tmp/agui_hitl_user_input.db"),
instructions=(
"You help users with tasks that may need their input. "
"Use available tools when needed - they are provided by the frontend."
),
markdown=True,
)
agent_os = AgentOS(
agents=[user_input_agent],
interfaces=[AGUI(agent=user_input_agent, prefix="/user_input")],
)
app = agent_os.get_app()
if __name__ == "__main__":
agent_os.serve(app="hitl_user_input:app", port=9001, reload=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[agui,os]" openai
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
hitl_user_input.py, then run:python hitl_user_input.py
Was this page helpful?