from hud import Environment
from hud.tools import AgentTool, BashTool, EditTool
from hud.agents import create_agent
import hud
# Specialist environments
researcher_env = Environment("researcher")
# ... setup researcher tools and scenario
coder_env = Environment("coder")
coder_env.add_tool(BashTool())
coder_env.add_tool(EditTool())
@coder_env.scenario()
async def fix_bug(description: str):
yield f"Fix the bug: {description}"
yield 1.0
# Orchestrator with sub-agent tools
orchestrator = Environment("orchestrator")
orchestrator.add_tool(AgentTool(
researcher_env("investigate"),
model="gpt-4o",
name="research",
))
orchestrator.add_tool(AgentTool(
coder_env("fix_bug"),
model="claude-sonnet-4-5",
name="fix_code",
))
@orchestrator.scenario()
async def handle_ticket(ticket_id: str):
yield f"Handle support ticket {ticket_id}"
yield 1.0
# Run orchestrator
task = orchestrator("handle_ticket", ticket_id="TICKET-456")
agent = create_agent("gpt-4o")
async with hud.eval(task) as ctx:
await agent.run(ctx)