Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A long-running agent does not automatically carry its entire past into a fresh model call. Each call receives an active input; continuity comes from the application or platform supplying saved state again, or from a compacted version of earlier context. To design a reliable resume path, decide who owns that state, how it is restored, and what happens when the history grows too large.

What “context” means when an agent runs over time

It helps to distinguish three things that are often lumped together as context:

  • Durable state: information stored outside the active model input, such as prior messages in application storage or a provider-managed conversation.
  • Active input: the material actually supplied to a particular model call. A saved conversation is not useful to that call unless the chosen continuation mechanism makes it available.
  • Carried-forward history: selected or compressed information from earlier turns, included so the agent can continue without sending the entire original history.

A cold start is therefore a fresh run that needs its input assembled. Restarting a process by itself does not restore the agent’s prior state.

How can an agent resume after a cold start?

There are three broad patterns: the application can replay stored history, an SDK session can manage retrieval and saving, or the provider API can continue server-managed state using an identifier. These approaches differ in who owns history and what the caller sends on the next turn.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Continuation pattern Who owns the state What happens on a later turn Useful distinction
Application-managed history The application The application retrieves, selects or filters stored history, then includes it with the new request. Offers control over storage and input construction; the application must implement replay and any filtering.
Agents SDK session The session integration and its configured storage The session retrieves prior items for a run and saves new items afterward. Supports session-based continuity and can also support resuming an interrupted run when the same session storage is available.
Conversations API identifier OpenAI’s server-managed conversation state The caller supplies a conversation ID to continue the conversation. OpenAI’s running-agent guide describes this as useful for state shared across workers or services.
Responses API previous-response identifier OpenAI’s server-managed response chain The caller supplies a previous response ID to continue that chain. OpenAI’s running-agent guide presents this as a lighter server-managed continuation option.

The distinctions in the table follow OpenAI’s Agents SDK session documentation and its guide to running agents. The exact history items and request shape depend on the selected API pattern; do not assume that every pattern sends the same payload.

What does an Agents SDK session do when a run starts and ends?

In the documented OpenAI Agents SDK Python session pattern, the runner handles a retrieve-and-save cycle around the run. Prior session items are retrieved and prepended to the run input; afterward, new items are stored, including user input, assistant responses and tool calls.

  1. Choose a session and storage backend. The session ID identifies the history to use; the underlying storage must remain available when the agent is restarted.
  2. Start the run with that session. The session integration retrieves its previous items and supplies them before the new input.
  3. Let the run complete or reach an interruption. Items produced during the run are saved to the session as part of the documented session flow.
  4. For a later turn, reuse the session. The same session instance can be used, or another instance can use the same session ID with the same underlying storage backend.
  5. For an approval interruption, resume with the same stored session. The SDK documentation describes resuming the run with the same session instance or a new instance connected to that same session ID and storage.

A session is not a magic memory attached to a process: its continuity depends on the session ID and storage being available to the next run. This is the useful distinction between resuming an ordinary later turn and resuming a run paused for approval: the latter needs the interrupted run’s relevant state, not merely a new conversation prompt.

How do OpenAI server-managed continuations differ?

OpenAI’s running-agent guide treats application-managed result.history, an SDK session, a Conversations API conversationId, and a Responses API previousResponseId as distinct continuation strategies. The two API identifiers are provider-side continuation mechanisms; they are not interchangeable with replaying a local history array or loading an SDK session.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In general, use one continuation strategy for a conversation. Replaying client-managed history while also continuing provider-managed state can send overlapping history and duplicate context. OpenAI’s guide recommends avoiding that combination in most cases.

Why context grows, and how compaction helps

As an agent accumulates turns, tools and results, replaying everything can make the active input grow. Compaction reduces the context needed for subsequent turns by carrying forward a compacted representation of prior state. It is a bounded-context technique, not a guarantee that every original detail survives or can later be recovered verbatim.

OpenAI: threshold-triggered compaction

OpenAI’s Compaction API documentation describes server-side compaction during a Responses request when a configured token threshold is reached. The response stream includes an encrypted compaction item. The documentation characterizes that item as opaque rather than human-interpretable.

For a stateless input-array chain, the documented continuation is to append the output items, including the compaction item. When using previous_response_id, send the new user message and keep the response chain. These are different request patterns; follow the one that matches how the conversation is being continued.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

OpenAI: standalone compaction

OpenAI also documents a standalone compact endpoint. It accepts a full context window and returns a compacted window for a later request. The returned window may include retained earlier items as well as the compaction item. OpenAI instructs developers to pass that returned output through as-is rather than pruning it.

Anthropic: automatic and on-demand compaction

Anthropic’s Claude Platform documentation describes automatic threshold compaction and on-demand compaction. In its threshold mode, older context is summarized when the configured input threshold is reached, a compaction block is created, and the conversation continues with compacted context. Anthropic describes this as extending effective context length for long-running conversations and tasks; its configuration and semantics should not be assumed to match OpenAI’s.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Which continuation approach should you choose?

Choose based on the operational boundary that matters, rather than treating all forms of “memory” as equivalent.

  • Choose application-managed history when the application needs direct control over storage, filtering or selection before assembling model input. It must handle history retrieval and decide what to replay.
  • Choose an SDK session when session storage and resumable runs fit the application’s orchestration model, including cases where a run may pause for approval.
  • Choose a Conversations API ID when OpenAI server-managed conversation state and continuity across workers or services fit the design.
  • Choose a previous response ID when a lighter server-managed Responses API continuation suits the conversation flow.
  • Add compaction or selective history management when a growing record needs to be bounded. Decide what durable facts must live outside the compacted conversation, since compaction is not a promise of lossless recall.

Application-managed state gives the application storage control, while provider-managed continuation is tied to the relevant provider API. The cited documentation describes those ownership differences, but does not establish a neutral benchmark for portability or comparative continuation quality.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.