hitl_tool_confirmation.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_tool_confirmation.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 Tool Confirmation
======================
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
confirmation_agent = Agent(
name="tool_confirmation",
model=OpenAIResponses(id="gpt-5.5"),
db=SqliteDb(db_file="/tmp/agui_hitl_confirmation.db"),
instructions=(
"You help users with tasks that may require confirmation. "
"Use available tools when needed - they are provided by the frontend."
),
markdown=True,
)
agent_os = AgentOS(
agents=[confirmation_agent],
interfaces=[AGUI(agent=confirmation_agent, prefix="/tool_confirmation")],
)
app = agent_os.get_app()
if __name__ == "__main__":
agent_os.serve(app="hitl_tool_confirmation: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_tool_confirmation.py, then run:python hitl_tool_confirmation.py
Was this page helpful?