Examples
Small, runnable agents that pause for a human in Vigilator - one per framework, each with a polling and a webhook driver.
Every example is a complete project in the Vigilator/examples repository. Each one defaults to Anthropic Claude, uses the official Python or TypeScript SDK, and shows the same three things: an interrupt landing in the inbox, the run streaming to Live View, and the agent resuming after the decision - by polling, or through the interrupt.answered webhook.
| Example | Language | How the agent pauses | Decisions shown |
|---|---|---|---|
| LangGraph | Python | A hand-built graph raises interrupt() for gated tools | approve, edit, reject |
| LangGraph.js | TypeScript | Tools call interrupt() | approve, edit, reject, respond |
| LangChain | Python | create_agent with HumanInTheLoopMiddleware | respond, then approve / edit / reject |
| DeepAgents | Python | create_deep_agent with interrupt_on | approve, reject |
| Mastra | TypeScript | requireApproval tools and suspend() | approve, reject, respond |
| Ask a human | Python | One question tool, respond only | respond |
| Durable resume | Python | State in a database, resumed by another process | approve, edit, reject |
LangGraph
A refund agent whose refund step needs approval, with a typed edit form.
LangGraph.js
The same pattern in TypeScript, with a question tool and an email tool.
LangChain
Middleware does the pausing - two interrupts in one run, no graph code.
DeepAgents
A report writer with a research subagent; only publishing needs a human.
Mastra
Tool approval and suspend() mapped onto Vigilator, with runs persisted in LibSQL.
Ask a human
The minimal integration: a question, and an answer that becomes the tool result.
Durable resume
Checkpoint to SQLite or PostgreSQL, exit, and resume from the webhook.
Before you start
- An API key for your organisation, created under Integrations → API keys.
- An Anthropic API key. Each example takes a
MODELvariable if you would rather use another provider. - For the webhook flow, an endpoint under Integrations → Webhooks subscribed to
interrupt.answered, and a way for Vigilator to reach your machine - see testing locally.
The common shape
Each example has the same three parts, so once you have read one the rest are familiar:
- The agent - the framework code, plus the list of tools that need a human and the decisions a reviewer may take on each.
- The bridge - a single file that turns the framework's pause into a Vigilator interrupt, the reviewer's decision back into the framework's resume value, converts messages for Live View, and keeps one session per stretch of uninterrupted work. Copy it into your own project.
- Two drivers - one that polls
get_interruptuntil the interrupt is answered, and a small web server that resumes the run when theinterrupt.answereddelivery arrives.
The examples share a few conventions. Every interrupt and session is opened with externalId = "<example>:<thread_id>", so a receiver can tell its own events from anything else - including the dashboard's send test event, which the receivers acknowledge and ignore. Receivers listen on POST /webhooks/vigilator, port 8000, which matches the svix listen command on the webhooks page.
Sessions and the wait for a reviewer
A Live View session that goes quiet longer than the organisation's session timeout is ended automatically. Waiting for a reviewer can take a while, so every example ends the session before the wait and starts a fresh one - same externalId, seeded with the transcript - when the run resumes. Raise the timeout instead if you prefer one session per run.