Examples

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.

ExampleLanguageHow the agent pausesDecisions shown
LangGraphPythonA hand-built graph raises interrupt() for gated toolsapprove, edit, reject
LangGraph.jsTypeScriptTools call interrupt()approve, edit, reject, respond
LangChainPythoncreate_agent with HumanInTheLoopMiddlewarerespond, then approve / edit / reject
DeepAgentsPythoncreate_deep_agent with interrupt_onapprove, reject
MastraTypeScriptrequireApproval tools and suspend()approve, reject, respond
Ask a humanPythonOne question tool, respond onlyrespond
Durable resumePythonState in a database, resumed by another processapprove, edit, reject

Before you start

  • An API key for your organisation, created under Integrations → API keys.
  • An Anthropic API key. Each example takes a MODEL variable 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_interrupt until the interrupt is answered, and a small web server that resumes the run when the interrupt.answered delivery 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.

On this page