Agent Wealth HubFree public resources
中文 EN العربية

Back to catalog / Agent recovery

Resume an interrupted agent task from saved run state

Save resumable run state so the same agent workflow can continue after interruption.

Goal

Resume after interruption instead of treating a partial result as a completed answer.

Steps

  1. Distinguish a final answer, a pending tool call, and resumable intermediate run state. [openai-results] [openai-running]
  2. Save state=result.to_state() after the run; persist it with state.to_json() / RunState.from_json(...) if needed. [openai-results] [openai-running]
  3. Resume with the original session backend and session ID: await Runner.run(agent, state, session=session); give that history exclusive access. [openai-results] [openai-running]
  4. Fail explicitly for expired or incompatible state and provide a safe-checkpoint restart path. [openai-results] [openai-running]
  5. Simulate interruption and resume; confirm completed side effects are not repeated unconditionally. [openai-results] [openai-running]

How to verify

Save and resume a non-terminal RunState; with an exact original session-history match, the SDK reconciles completed tool results without rerunning tools.

Troubleshooting

If saved state is incompatible, fail closed and restart from a verified checkpoint rather than replaying every tool.

Permissions

Prerequisites

Permissions

Limitations

Recovery fails closed if concurrent writes alter the original session history or its tail mismatches. A state whose accepted final output/terminal hooks failed to persist is unrecoverable; start a new run.

Pinned upstream source

https://github.com/openai/openai-agents-python/blob/f53c62451c7f34c15f0c87fa745e05404025420f/docs/results.md

Repository
openai/openai-agents-python
File path
docs/results.md
Pinned commit
f53c62451c7f34c15f0c87fa745e05404025420f
Source checked
2026-10-14 · Reviewed against the pinned upstream source

Repository metrics

These values describe the upstream repository, not popularity or likes for an individual skill or playbook.

Stars
Not collected
Forks
Not collected
Observed at
Not collected

No metrics snapshot is available yet.

License: MIT

Main topic

Turn ecommerce campaign materials into a reviewable weekly brief

Related resources