Skip to content

Durable Execution with Restate

Heartbit integrates with Restate for durable agent execution. Agent loops survive crashes, tools execute exactly once, and state persists across restarts.

  • Durable execution with replay — agent loops survive crashes
  • Exactly-once tool execution — tools don’t re-execute on recovery
  • Token budget tracking — persistent budget across workflow restarts
  • Circuit breaker — LLM fault tolerance with automatic recovery
  • Recurring tasks — scheduler for periodic agent invocations
ComponentTypeDescription
AgentService#[restate_sdk::service]llm_call + tool_call activities
AgentWorkflow#[restate_sdk::workflow]Durable ReAct loop with replay
OrchestratorWorkflowworkflowDelegates to child AgentWorkflow instances
Blackboardvirtual objectShared state across agents
Budgetvirtual objectToken tracking
CircuitBreakervirtual objectLLM fault tolerance
Schedulervirtual objectRecurring task scheduling
Terminal window
# Start Restate + worker
docker compose up -d
# Register the worker with Restate
curl -X POST http://localhost:9070/deployments \
-H 'content-type: application/json' \
-d '{"uri": "http://heartbit:9080"}'
# Submit a task
heartbit submit --config heartbit.toml "Analyze the Rust ecosystem"
# Check status
heartbit status <workflow-id>
# Approve tool execution (when --approve was used)
heartbit approve <child-workflow-id>
# Get result
heartbit result <workflow-id>
[restate]
endpoint = "http://localhost:9070"
Terminal window
docker compose up -d

Services:

  • restate — Restate server (ports 8080 ingress, 9070 admin)
  • heartbit — worker (port 9080)

Restate support requires the restate feature flag:

Terminal window
cargo build --features restate
CommandDescription
heartbit serveStart the Restate HTTP worker
heartbit submit <task>Submit task for durable execution
heartbit status <id>Query workflow status
heartbit approve <id>Send approval signal
heartbit result <id>Get completed workflow result