HUMAN_IN_THE_LOOP
TUTORIALInsert human approval steps into your agent workflows for sensitive operations.
THE_SAFETY_PROBLEM#
You don't want an agent to delete a production database or send an email to the CEO without checking first. AKIOS allows tools to pause execution and wait for permission.
STATE_RUNNING
Agent processes inputs and selects tools normally.
STATE_PAUSED
Execution halts before sensitive tool call.
STATE_RESUMED
Continues with human approval or feedback.
1
FLAG_TOOL_AS_REQUIRES_APPROVAL
tools/email.ts
2
HANDLE_THE_INTERRUPTION
When the agent tries to call this tool, `run()` will return early with a status of `paused`.
server.ts
PERSISTENT_STATE
For this to work in a web app, you need a persistent `MemoryStore` so the agent can be rehydrated when the user approves (which might be hours later).