Guides

State Management


State management in Orcher allows workflows to maintain persistent key-value state that survives restarts, crashes, and replays. You can store progress indicators, intermediate results, and status flags using set_state() and get_state() — and external systems can query that state in real time via registered query handlers, all without blocking the workflow.

Key Characteristics

  • Durable — State is reconstructed from the journal on replay, so it survives crashes
  • Scoped — Each workflow execution has its own isolated state
  • Type-Safe — Compile-time type checking via serialization/deserialization (JSON)
  • Queryable — External systems can query state through registerQueryHandler without blocking execution
  • Replay-Safe — State is consistent across first execution and replay
Workflow
set_state("status", "processing")
execute_task(work)
set_state("progress", "75%")
set_state("status", "done")
◄
►
State (KV)
status"done"
progress"75%"
query
External Client
read state anytime

Explore State Management