Node.js runtime required for Temporal workers. Temporal’s workflow runtime uses V8 isolates and cannot run in Deno. Use
MockTemporalAgent in Deno for unit tests - it works without a Temporal server.How it works
The key insight:workflowFn is a deterministic orchestrator. It schedules activities (model turns, tool calls) as separate execution units. If the worker crashes mid-run, Temporal replays workflowFn from its event history and skips already-completed activities, resuming exactly where it left off.
Installation
Temporal requires three npm packages. These must run in a Node.js process:@vibesjs/sdk) provides TemporalAgent and MockTemporalAgent. No separate Temporal-specific Vibes package is needed.
TemporalAgent setup
TemporalAgentOptions fields:
TemporalActivityOptions fields:
Worker setup (Node.js process)
The worker runs in a Node.js process. It registerstemporalAgent.activities (a property) and a workflowsPath pointing to your workflow file.
workflows.ts file re-exports temporalAgent.workflowFn (also a property):
Starting workflows
Workflows are started via the Temporal client - there is no framework method for this. The client connects to the Temporal server and schedules execution on the worker’s task queue.Migration Warning: Five API Bugs in Old Documentation
MockTemporalAgent (testing)
MockTemporalAgent runs the same agent logic as TemporalAgent but without a real Temporal server. It records activity history for assertions, supports deterministic replay, and works in Deno.
MockTemporalAgent methods:
Testing pattern
Serialization helpers
When passing agent state through Temporal (which serializes all workflow arguments and results), you may need to convert between VibesModelMessage types and JSON-serializable formats.