Skip to main content

Temporal Integration

AgentVisor™ uses Temporal for durable execution, ensuring agents survive crashes and enabling human-in-the-loop patterns.

Configuration Guide

For step-by-step configuration instructions, see the Temporal Configuration Guide. This page focuses on concepts and architecture.

Overview​

Temporal provides:

  • Durability: Workflow state survives process crashes
  • Reliability: Automatic retries and failure handling
  • Visibility: Workflow history and state inspection
  • Signals: Async communication with running workflows

How AgentVisor Uses Temporal​

Threads as Workflows​

Each conversation thread is backed by a long-lived Temporal workflow. Creating a thread starts the workflow; deleting a thread cancels it (not terminates — cancellation lets the workflow observe the request and wind down cooperatively, including waiting for an in-flight activity's cancellation handling, rather than being killed outright). Run creation, checkpoint saves, and state queries are all routed through the workflow via Temporal's update and query primitives, so they are durable and ordered.

Each thread also carries a small set of Temporal search attributes (principal, graph name, status, and user-defined metadata) that make it discoverable via the API without reading full workflow history. See the Temporal Configuration Guide for the attribute list and one-time cluster setup.

Runs as Activities​

Each agent run is a Temporal activity. The host runtime starts the activity in response to a run-create update; the activity invokes the agent inside the guest sandbox; the result is recorded back in workflow state. Activities are the right Temporal primitive here because they isolate non-deterministic, side-effecting work (the actual agent invocation) from the deterministic workflow.

Temporal activities execute with at-least-once semantics: an activity can be retried after certain failures, so anything it does must tolerate re-execution. This is why AgentVisor's automatic restart resumes a failed run from its last checkpoint rather than re-invoking the agent from scratch, and why it never restarts a failure the agent itself raised — see Checkpointing → Recovery Scenarios for the full breakdown of what restarts automatically and what doesn't.

Workflow Lifecycle​

Checkpointing and Continue-As-New​

Agent state is stored in the workflow. Saves route through Temporal workflow updates, so checkpoints are durably persisted in the workflow's event history before the save call returns. For long-running threads, AgentVisor periodically compacts that history using Temporal's Continue-As-New mechanism — transparent to API callers in the common case, since the thread ID stays stable across the transition.

For the full checkpointing model — what gets saved, recovery scenarios, and how Continue-As-New works — see Checkpointing. For checkpoint size ceilings and the knobs that raise them, see Checkpoint Sizing and Limits.

Interrupt/Resume​

LangGraph's interrupt() API integrates with Temporal. When the graph raises GraphInterrupt, AgentVisor checkpoints workflow state durably, returns status: interrupted to the caller, and waits for the next run. Resuming creates a new run on the same thread, and the graph continues via Command(resume=input).

For the user-facing API and a sequence diagram, see Checkpointing → Interrupt/Resume Pattern.

Payload Encryption​

AgentVisor can encrypt Temporal workflow payloads at rest — agent inputs, outputs, and checkpoints — so the Temporal server itself stores only ciphertext. See Payload Encryption for the encryption model, and the Temporal Configuration Guide for setup.

See Also​