Transcript state and application state

Conversation continuity and per-run application data solve different problems, so design them as separate state channels.

An Agents SDK session represents remembered exchanges for one session identity; it can spare an application from rebuilding prior model input on every turn.

By contrast, RunContextWrapper carries an application-owned object through tools, callbacks, and run hooks. That object remains outside the model payload.

Use the local object for request-scoped dependencies, policy inputs, and helper services. Put only information the model needs to reason over into the turn history or current input.

Conversation continuity methods

Select a single owner for transcript progression before implementing a multi-turn workflow.

  • Choose an SDK session when the application wants the SDK to read prior session items and record the items produced by a completed run.
  • Choose explicit input assembly when the application needs direct control over which earlier material is carried to the next model call. The SDK documentation identifies result.to_input_list() as one such option.
  • Choose an OpenAI-managed continuation identifier when server-side continuation is the intended design; the supplied material identifies conversation_id, previous_response_id, and auto_previous_response_id in that category.

Do not pass a session together with any of those server continuation fields for one run; the documented designs are mutually exclusive at that boundary.

The supplied API reference indicates that creating a Conversation is an available operation, but it does not provide enough detail here to prescribe its request shape or persistence behavior.

Model-call input

Session history is normally combined with the new turn before execution. When that default ordering or filtering is unsuitable, RunConfig.session_input_callback can alter the composed input.

Make the inclusion rule intentional. For example, a support workflow may retain the relevant transcript while keeping an internal account identifier in local context, where tools can use it without exposing it as model-visible text.

Shared policy data can inform tool, MCP-filtering, and handoff callbacks. Those visibility controls are not a substitute for checking authorization against the actual arguments and target resource when an action is requested.

Continue reading: Designing Prompt-Injection Defenses for Tool-Using Assistants.

Recovery, storage, and secrecy

For an interrupted session-backed run, the returned execution state can be supplied again using the original session object, or another object that points to the same session key and storage implementation.

The provided material does not establish locking, transactional guarantees, scaling behavior, or history-size handling for session stores.

Do not place credentials in RunContextWrapper.context when serialized run state could be stored or sent elsewhere.

Continue reading: Troubleshooting Durable Agent Runs: Retries, Checkpoints, and Side Effects.

Architecture checklist

  1. Classify each datum: transcript content, model input, local dependency, policy signal, or secret.
  2. Do not pair an SDK session with a server-managed continuation field in the same run.
  3. Specify how history is selected, trimmed, and merged with the incoming turn.
  4. Define session identity ownership and the storage model required for restart recovery.
  5. Enforce authorization at the action boundary, not merely when deciding whether a capability is shown.
  6. Verify current SDK and API contracts before deployment, particularly for Conversations API behavior and version-specific session details.

Limits of the supplied documentation

The available excerpts contain no dated version information, performance figures, retention terms, or comparative cost data. They also leave the exact Conversations API contract and the operational differences among continuation identifiers unresolved.