Intermediate·Concept·2 min read

Workflow State and the Ledger

Practice this question

A multi-turn workflow needs a reliable memory of what has happened. That is different from merely sending the whole chat history back to an LLM.

A workflow ledger can store structured, validated facts such as:

JSON
{
  "customer_verified": true,
  "transaction_id": "txn_example_123",
  "dispute_reason": "unrecognized_transaction",
  "replacement_card_requested": null,
  "action_confirmed": false
}

The ledger should distinguish between:

  • Unknown: No usable answer has been collected yet.
  • Known: A value has been collected and validated.
  • Pending: A required question or confirmation is still open.
  • Completed: A permitted action or workflow step has finished.

This prevents the system from treating conversational wording as authoritative state.

Adapted from 19_deterministic_workflow_engine_learnings.md · “5. Workflow State and the Ledger”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.