Chapter 23: Run state and messages

Temporal workflow history holds the run state. It holds the step count, the state, the approval, and the result. Spring AI Session holds the messages and tool calls. Use the workflow id as the session id. Do not store run state in a separate table. Two stores for one run drift apart.

Figure 23.1. Each fact about a run has exactly one home. A third store, struck out here, would have to agree with the other two and eventually would not.

Exercise. Start a run. Kill the worker after step 2. Restart it. Confirm the run completes without repeating step 1.

Figure 23.2. What you should see in the exercise. Recorded results are replayed from history, not run again.
docs