Counting visitors…
Browse all docs
Start · 9Find your path through RunifoldLearn Runifold in 45 minutesUnderstand the complete Runifold platformYour first trustworthy runChoose the right execution APIChoose crates and Cargo featuresBuild common Runifold applicationsRunifold frequently asked questionsTroubleshoot Runifold applications
Execution kernel · 7Understand RunContextCoordinate external effects safelyBound work with budgets and cancellationHandle errors and retries safelyEvents, journals, and execution evidenceDesign capability-safe executionRecover safely from checkpoints
Models & providers · 7Route across models without duplicate outputChoose and configure a providerUse the provider-neutral model protocolBuild on the Provider Runtime contractUse OpenAI control-plane and Realtime APIsTest and benchmark provider adaptersSet up OpenAI, Anthropic, Gemini, and Ollama
Agents · 7Build and configure an AgentGive an Agent typed toolsAdd conversations and semantic memoryDelegate to child Agents safelyReturn structured Rust valuesStream without losing semanticsGround an Agent with retrieval
Durable workflows · 7Compose deterministic workflowsMake workflows durableOperate durable workflow workersCoordinate timers, signals, and durable waitsRun multi-tenant workflow infrastructureRun parallel branches and safe racesVersion and evolve durable workflows
Integrations · 7Connect through MCPChoose stores and persistence boundariesExpose durable work through MCP TasksBuild and evaluate retrieval pipelinesUse MCP Resources, Prompts, and SamplingCache MCP responses without crossing authorityDeploy Runifold in a Rust web service
Quality & operations · 10Test without the networkEvaluate quality and prevent regressionsObserve the complete run treeRun safely in browsers and at the edgeRead reliability claims preciselyRun reproducible evaluations in CIOperate Runifold with SLOsGovern Task retention and deletionArchive audit evidence to S3-compatible WORM storageManage compatibility and trusted releases
Docs/Workflows
NEW TO RUNIFOLD?Build the complete mental model in 45 minutes
Workflows

Make workflows durable

Checkpoint progress, wait without holding a process, recover leases, and resume with explicit policy.

Practical guide·16 min

Durability model

A durable workflow persists semantic progress, then lets any compatible worker continue it. Process uptime is not part of correctness.

Use durability for work that survives deploys, waits for people or timers, coordinates costly effects, or must recover after a worker disappears.

Run one durable task locally

Enable SQLite for a single-machine durable worker. Use PostgreSQL instead when multiple processes or hosts must claim work concurrently.

Cargo.toml
[dependencies]
runifold = { version = "=0.9.0", features = ["sqlite-bundled"] }
serde_json = "1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Assuming workflow is the Workflow built in the Workflow guide, this creates the durable control plane, registers the exact definition, enqueues one task, and runs one claim cycle:

use std::{sync::Arc, time::Duration};
 
use runifold::{
    Budget, CapabilitySet, LeaseDuration, WorkerId, WorkflowDefinition,
    WorkflowRegistry, WorkflowStore, WorkflowTask, WorkflowWorker,
    sqlite::SqliteWorkflowStore,
};
use serde_json::json;
 
let store = Arc::new(SqliteWorkflowStore::open("runifold-workflows.db")?);
let mut registry = WorkflowRegistry::new();
registry.register(WorkflowDefinition::new(
    Arc::new(workflow),
    Budget::default(),
    CapabilitySet::new(),
))?;
 
store
    .enqueue(WorkflowTask::new(
        "order-intake",
        1,
        json!({ "order_id": "ord_42" }),
    )?)
    .await?;
 
let worker = WorkflowWorker::new(
    store,
    registry,
    WorkerId::parse("worker-local-1")?,
    LeaseDuration::new(Duration::from_secs(30))?,
    Duration::from_secs(10),
)?;
let outcome = worker.run_once().await?;
println!("{outcome:?}");

run_once() returns Idle, Completed, Retried, Suspended, Failed, DefinitionUnavailable, or LeaseLost. Production services normally wrap the worker in a bounded supervisor; use run_once() in tests and when integrating with an existing job loop.

Checkpoints and revisions

Checkpoints record the workflow definition, current phase, completed step outputs, budget state, and recovery metadata. Revisions prevent two workers from committing incompatible progress.

Keep step outputs serializable, compact, and versioned. Store large artifacts outside the checkpoint and reference them by immutable ID.

Timers, signals, and review

A wait persists intent without holding a thread or process. Timers wake after a deadline; signals wake on an external event such as approval.

Signal names and payloads are application contracts. Authenticate the sender, deduplicate by signal ID, and retain enough history to explain who resumed the workflow and why.

Workers and leases

Workers claim tasks using finite leases. A healthy worker renews its lease; another worker may recover the task after expiry.

The SQLite store is useful for local durable execution. Use the PostgreSQL workflow feature for distributed workers and multi-process coordination.

Recovery policy

Recovery must distinguish a safely repeatable step from an effect whose result is unknown. Configure resume policy per boundary and reconcile ambiguous effects before proceeding.

Deploy compatible workflow definitions while old tasks exist. Treat step IDs, serialized state, and signal names like a database schema.

Recovery drill

Before production, run this drill against the real store:

  1. enqueue a task with a known checkpoint ID;
  2. terminate the worker while a deterministic step is in flight;
  3. wait beyond the lease duration and start a different worker identity;
  4. verify completed steps are not repeated and usage never decreases;
  5. repeat at an external write boundary and confirm the result becomes replayed or ambiguous according to Effect evidence—not guessed from a timeout;
  6. deploy definition version 2 while a version 1 task is waiting and verify both definitions remain registered.

Common failures

Outcome or errorMeaningFix
DefinitionUnavailableworker lacks the task's name/versiondeploy or re-register that exact definition
LeaseLostanother owner may now actstop writing immediately; let the current owner recover
repeated Retriedfailure policy or tenant budget deferred workinspect typed failure and retry delay
checkpoint conflictstale revision attempted to commitdiscard stale state and reload
ambiguous in-flight stateexternal completion is unknownreconcile; never silently mark success or rerun
task remains waitingtimer not due or signal not acceptedinspect wake time, tenant, signal name, and dedupe ID

See workers, waits and signals, checkpoint recovery, and workflow versioning for the corresponding control-plane details.