Helpdesk: the full HITL toolkit
| Tool | HITL pattern | Why |
|---|---|---|
restart_service | requires_confirmation=True | Restarting prod is irreversible. Human approves first. |
create_support_ticket | requires_user_input=True | Need details from the user before creating. |
run_diagnostic | external_execution=True | Diagnostic runs in another system. The agent gets the result back. |
UserFeedbackTools() | Structured question to user mid-run | ”Which service do you want to restart?” |
Approvals: compliance gates
@approval(type="required") blocks the run until a human approves. Audit log captures both the request and the decision.
@approval(type="audit") runs the tool but logs to the audit trail asynchronously. Used when policy says “this needs to be tracked, not gated.”
Feedback: structured questions mid-run
UserFeedbackTools lets the agent pause and ask a structured question:
Agent: I need to know your team size. Please pick one: [1-5, 6-20, 21-100, 100+]The user picks. The run resumes with the answer in scope. No prompt engineering, no hand-rolled flow control.
UserControlFlowTools adds branching. The agent can offer choices and route based on the user’s pick:
Agent: Want to (a) keep the current settings, (b) reset to defaults, or (c) customize?
Pre-hooks for input safety
PII detection and prompt injection guardrails are pre-hooks that run before the model sees the user message:Post-hooks for output safety
Output guardrails and audit logs run after the model produces output. The Helpdesk agent demonstrates both:@hook(run_in_background=True). See Human-in-the-Loop for the full pattern.
See it in action
agents/helpdesk/, agents/approvals/, agents/feedback/