Skip to main content

Agent session handoff: what survives the context window

Rafael Torres
Rafael TorresNovember 20, 202615 min. read
Agent session handoff: what survives the context window

The session ends, but the task does not. In an agent session handoff, saving a conversation does not prove that the next agent can open the files, has the authority to act or knows whether an external operation finished; without those answers, continuing can mean repeating an effect or working on the wrong version.

Decision box / Key facts:

  • A summary guides reading. It does not prove the content of the files it cites.
  • A checkpoint marks a state, but it does not guarantee that an external effect happened once: the receiving session must reconcile the recorded point with the state of the external system before resuming.
  • An unknown result blocks automatic replay, unless a valid guarantee applies to the effect at the destination or authoritative reconciliation confirms the absence of an effect and the impossibility of completion by the previous attempt.
  • The guarantee must be valid and applicable to the relevant effect at the destination, such as conditional idempotency through a destination precondition, an idempotency key or an operation that is intrinsically idempotent by the API contract. The precondition protects the effect and the resource it covers, not every incidental effect of the call. Authoritative reconciliation must establish that no previous attempt executed the action and that none can still execute it. A valid and applicable guarantee allows a new attempt without a prior query, but it does not prove the result of the previous attempt. In this flow, the conservative operating policy forbids a new attempt when there is a verified record of the effect.

What is an agent session handoff?

An agent session handoff is the explicit transfer of the information required to continue a task outside the session that started it. Saved history, a summary, artifacts and persisted state are not equivalent. Before acting, the receiving session checks evidence, permissions and external effects; the message received, alone, does not prove completion.

The agent session handoff gathers the information a receiving session must check before continuing the task started by another session. The sender records the objective, the proven step, open items and references to the artifacts; the receiver opens the available evidence and verifies the version and the authorization. A reference does not prove content. The session resumption documentation distinguishes resuming a session, keeping the identifier and appending messages to the history, from branching, copying the history to another identifier. That behavior belongs to the documented implementation, not to every agent session. Even with saved history, the receiver's access to the files and the tools must be verified. If an external operation was left without a verifiable response, the contract records the result as unknown. The receiver does not turn the summary into proof of success, nor does it automatically repeat the operation without the applicable safety conditions.

The sender records what it managed to prove and what still requires work. The receiver, which may be another agent or a new session of the same agent, verifies its own access and rebuilds the environment it needs before acting. Between them there is a boundary: what the first session consulted may be unreachable in the next one, even when the instruction to continue looks clear and the history was saved.

An identifier, on its own, does not prove legitimate access.

Evidence is the point that separates continuity from guesswork. A reference to a file allows a delivery to be investigated if the receiver can open it; a message stating that the delivery exists does not prove its content or its version. The handoff contract must preserve that difference, especially when the next action changes data or communicates a decision outside the session.

What survives when the context window ends?

What survives is what the system preserved and the receiver can retrieve. Active context is the material available to the current execution; summary, history, files, memory and checkpoint depend on their own storage and access mechanisms. The presence of one of those mechanisms does not prove that the others reached the next session.

The end of a context window does not, by itself, determine which information reaches the next execution of the agent. In the documented compaction, the conversation in context gives way to a structured summary; some instructions are re-injected and some files may be reread with limits. Path and tool output rules may end up summarized. Persisted history is another layer: storing messages does not mean sending them in full in the next call. In the session memory example, an in-memory SQLite database disappears at the end of the process, while a file may persist. A persistent file helps the receiver when it is reachable and at the expected version. The team must check access and version before using its content to resume the task. The checkpoint records a recovery point, but it does not by itself prove the effect of an action at the external destination.

Compaction does not necessarily end the session: in the context compaction documentation, it may happen within the same session. Before and after compacting, the team must test critical decisions and calls and check their details in the original artifacts, without assuming full retrieval. The article on context limits and capacity distinguishes the context window from processing capacity.

Even with persisted history, the receiver may be unable to access it.

When changing process or environment, process memory, local variables, connections, child processes, working directory, sandbox state or available tools must not be assumed to survive. The exact boundary depends on the implementation. Some external resources may remain active after the session is lost; for that reason, the receiver must verify their state before recreating them or sending new operations.

Files and persisted memory also require a concrete question: which version did the receiver read? A path points to a location, not to the immutability of the content. A checkpoint records a recovery point, but its usefulness depends on what it contains and on what the system does at resumption. The text on memory and context as a platform function covers the memory layer; here the requirement is to check the material actually received.

Diagram of the handoff from session A to session B: summary, storage and artifacts as distinct layers, each one under verification

Are handoff, shared memory and checkpoint the same thing?

No. Handoff describes the passage required to continue work; shared memory offers a place for information that can be reached; a checkpoint records a recovery point. Each mechanism solves a different part of the problem. None of them, in isolation, proves that the receiver has access, authority and enough evidence to act.

Agent session handoff, shared memory and checkpoint solve distinct problems in agent continuity. The handoff gathers the state and the references selected for the next session. Shared memory offers storage reachable by different executions, but the team still has to check the origin, the version and the access to the data. The checkpoint records a recovery point defined by the implementation; for an external action, the receiver must confront the record with the state of the destination. There is also another use of handoff: control transfer in an SDK passes execution to another agent and accepts filters that change the history received. That transfer does not prove that the history will survive between independent sessions. A message or a path also does not grant read permission. For that reason, the receiver must confirm what it received, what it can open and what it is authorized to do before continuing.

MechanismPurposeWhat it transfers or recordsWhat it does not guaranteeRequired verification
Agent session handoffContinue the task after the switchState and references selected by the contractThat the content is complete or authorizedOpen evidence and check permissions
Shared memoryMake information available across executionsData written to reachable storageThat the information is current or applies to the taskCheck origin, version and access
CheckpointResume from a recorded statePoint and data defined by the implementationThat an external effect will not be repeatedReconcile the state with the external system
Handoff inside a flowPass control to another agentControl and history according to the mechanismPersistence between independent sessionsCheck the history actually received

When applying the handoffs documentation in an SDK, the contract must name who delivers the state, who executes the next action and who receives control.

The operating contract for long-running agents deals with execution over time. The handoff adds a narrower question: after the switch, which facts can the receiver demonstrate? A checkpoint may indicate where to continue, but the receiver still has to reconcile that position with artifacts and external effects.

What does the next agent need to receive?

The next agent needs a contract legible to whoever will execute it and verifiable by whoever will audit it. There is no mandatory official format here: the recommendation is to record objective, state, evidence, limits and next action, with origin and date. The content must separate confirmed facts from hypotheses and unknown results.

The handoff contract for the next agent must identify the authorized task, the last proven state, the deliveries and the open items. Each reference must point to a source the receiver can open and, when available, identify the version. Recorded decisions explain choices without replacing the original evidence. The contract must separate confirmed facts, hypotheses and unknown results, and record origin and date. Permission is another field. The documentation on messages between sessions describes text messages that do not automatically carry files or history and keep the receiving session's own permissions. The receiving agent checks its own authority and treats instructions found in the files as untrusted data. For tool calls, it records state, attempts and a verifiable result when available. Credentials must not be copied into the handoff; the receiver obtains access through the mechanisms authorized for its own session.

It starts with the objective and the scope. The record must state which delivery is authorized and what falls outside it, because a task that appears to continue may have changed direction during the previous session. Then comes the proven step: writing that the work is advanced is not enough; the last result the receiver can inspect must be identified.

The deliveries come with reachable paths or URLs, version identification and associated evidence. When there are decisions, the record explains the choice and the discarded alternatives to the extent needed to prevent the next session from reopening a decision already taken without noticing. That does not replace the source of the decision: it gives the receiver a map to find it.

Open items need a bounded next step, not a generic instruction such as continue. The contract also records blockers, uncertainties and the origin of the information. A hypothesis must appear as a hypothesis. When a tool returns an observable confirmation, the evidence points to that return or to the record that preserves it.

A file received is not an authorization.

The receiver checks provenance and integrity or version identifier when available, in addition to the identity of whoever authorized the task. Files, memories and tool results may contain untrusted instructions: they are data to examine, not orders of higher priority. The serialized state must exclude secrets and unnecessary data; read control and retention period must be defined in the actual storage.

The receiver verifies its own authority before executing: receiving a message does not grant access to the file it mentions. When examining sessions that exchange messages during the task, the team must verify the permission to access the material and record the actions, as described in the guide on agent permissions and traceability.

For each tool call, the contract distinguishes the states planned, awaiting approval, running, completed with a persisted result and unknown result. When available, it records the call ID, tool and version, required arguments, approval decision, attempts, result or verifiable reference and correlation with the external operation. Credentials do not belong in the handoff. The receiver uses the access mechanisms authorized for its session.

A summary and a history, by themselves, do not restore a call in progress. In the approval flow documented by the SDK, an execution paused for approval may be serialized as RunState, receive the decision and be resumed by the SDK's own mechanism. That differs from repeating an interrupted action after sending: the approval does not prove that the destination has not performed the effect, and an old state may lead to a new execution.

If the call was awaiting approval and has not been executed, the receiver confirms the approver's identity, the current authorization and the compatibility of the state before resuming through the intended mechanism. If the interruption happened during an action, it first establishes the external effect or verifies a valid idempotency guarantee at the destination. Without that, it does not turn the absence of a response into authorization to repeat.

How can state be verified before resuming?

The receiver must start with authority and end with a recorded next action. Between those points, it has to confront the contract with the sources of evidence and with the external system when the result of an action is unknown. Resuming is a decision based on reading, not an automatic continuation of the summary.

To verify state before resumption, the receiving agent checks the origin of the contract, the version of the artifacts and its own permission to execute the next action. Then it rebuilds the environment it needs and opens the evidence, separating the last proven result from hypotheses and open items. An unreachable path does not prove content. If an external call was left without a verifiable response, the team queries the destination and assesses whether the answer is authoritative: an empty or delayed read does not rule out an attempt still in progress. Permission decides what can be read and executed; content says what has already been done and what remains. Without a valid idempotency guarantee at the destination, a new attempt requires authoritative reconciliation that rules out both the previous effect and its future completion. Otherwise, automatic replay remains blocked. The decision and the evidence of the next action must be recorded.

  1. Check authority and version. Identify the task, the origin, the integrity and the date of the record; verify the receiver's identity and permission to access the materials and execute the next step. An old summary does not revoke a later restriction.
  2. Rebuild the environment. Verify or re-establish the working directory, sandbox, configuration, code and tool versions; open required connections and obtain credentials through authorized mechanisms. Check checkpoint compatibility and current permissions before loading it.
  3. Open artifacts and evidence. Check the paths, the available version and the records cited, treating retrieved content as untrusted data. An unreachable reference is a gap to resolve, not proof of verified content.
  4. Identify the last proven state. Separate what the evidence confirms from what the sender declared as intention, hypothesis or pending work; identify the state and the attempts of each call. Record divergences before moving on.
  5. Reconcile the unknown external effect. Query the destination by the available identifier and verify whether the response is authoritative. Empty query, delayed read or timeout do not prove absence: a previous attempt may still complete. With a valid idempotency guarantee at the destination for the same request, a new attempt is allowed even without a query; without that guarantee, repeat only after authoritative evidence that there was no effect and that the previous attempt cannot produce one. Outside those conditions, keep the result unknown and block automatic replay.
  6. Record the next action. Note what will be done, by whom or by which session, under which permissions and with which evidence of completion. If there is a blocker, the next action may be to route it, not to execute the operation.

That script treats the contract as a proposal subject to checking. The existence of a record does not eliminate the interval between writing and resumption, when permissions may change or a different version of an artifact may become available. The useful question is not whether the receiver read the summary, but whether it can sustain the action it intends to take. The guide on least privilege for agents details the distinction between read access and authorization to write.

Verification flow before resumption: permissions, evidence and external effect, with repetition barred when the effect is confirmed at the destination

Where does this contract fail in practice?

The failure appears when one mechanism is treated as a guarantee of another. A summary becomes assumed full history; a message becomes an assumed file package; a checkpoint becomes assumed proof of a single effect. The sources describe specific behaviors that allow those confusions to be identified before they become operating procedures.

The handoff contract fails when the team attributes to a summary, to a message or to a checkpoint a guarantee that the mechanism does not offer. The documented compaction selects information into a structured summary; the documented message between sessions does not automatically attach files or history. A checkpoint may record resumption without proving the result of an external action. If the response is lost after sending, both success and the absence of an effect require verification. A key written into the contract does not prevent duplicates by itself: the guarantee must hold at the destination for the same request. The contract may fix scope and retention period and still leave concurrent execution in another process outside the recorded check. Without a valid guarantee or sufficient authoritative reconciliation, the team keeps the result as unknown and blocks automatic replay.

A decision omitted from the selection requires the receiver to consult the original evidence before acting. What the sender saw must not be assumed available at resumption.

The engineering report on long-running agents describes continuity problems across windows and recommends incremental progress with artifacts for the next session. The useful point is the verifiable artifact, not a promise that every resumption will work. Without reading and verification, even a well-written record may point to an incomplete delivery.

The most delicate case is the interval between an external effect and its record. An action may have reached the destination while the session ends before recording a response the receiver can verify. At resumption, repeating the action without a query may produce a duplicate effect; deciding that it happened without evidence is also an error. The correct state, in that interval, is unknown. Agent scheduling control addresses a related boundary. In the documented CronJob implementation, suspending new triggers does not automatically cancel work already started; that behavior depends on the scheduler.

The error handling guidance for durable execution warns that activities may run more than once on new attempts and recommends idempotency and appropriate keys. The key must remain stable across attempts of the same logical operation, with the same parameters, and the destination must prevent duplicates atomically. Scope, retention period and the handling of divergent parameters must be verified. A key written only in the handoff does not offer that guarantee.

Concurrency changes the account. A query followed by a send is not atomic: between the two operations, the previous attempt or another receiver may complete the same request. The team must coordinate receivers through exclusion or appropriate version control and validate the result at the destination. Without a valid idempotency guarantee at the destination or sufficient authoritative evidence, the route is to reconcile the case, not to promise exactly-once execution. The discussion on durable execution for agents complements the distinction between recovering the execution and proving its effect.

What should a B2B team require?

A B2B team should require a testable resumption, with minimum access and evidence that survives the session switch. The test must include controlled interruption, version change and an unknown external result. The acceptance criterion is to demonstrate how each action was authorized and verified. A plausible answer is not enough.

Acceptance requires evidence that the receiver distinguished the proven state from the open items, checked its authority and recorded the next action or the blocker, pointing to the evidence that supports that decision. The result must show which version was consulted and allow the team to examine the decisions taken at resumption. That traceability must allow the intended action to be confronted with the authorization in force and with the artifacts actually available to the receiver. For external actions, the error handling guidance for durable execution provides a reference for assessing the guarantee applicable at the destination. A convincing answer is not enough: it must be demonstrated that the relevant effect was verified or that a valid condition exists for the next attempt. When the evidence does not resolve the unknown result and the applicable guarantee is not demonstrated, acceptance requires blocking automatic replay.

The test starts with an authorized task and an interruption point defined by the team. Then the receiver gets only the material foreseen in the contract and tries to identify the last proven state. If it needs a file it cannot read, the expected result is to record the gap, not to fill the content by inference. The same applies to a permission that is not available. The discussion on evaluating agents beyond the final answer examines the path and the tool calls, beyond the outcome.

In another passage of the test, the team changes the version of an artifact or revokes the access permission before resumption. The receiver must notice the difference and prevent an earlier instruction from being treated as current authorization. Traceability includes the origin of the contract, the record consulted and the evidence of the next action. Without that, an audit finds a conclusion, but not the path to it.

The team must test distinct windows: before sending; after sending and before the response; after the effect and before the record; and during concurrent resumption. In each one, it must compare the internal record with the effect observed at the destination, including a delayed query, key expiration, version change and revoked authorization. A test without a duplicate does not guarantee all future executions. It is bounded evidence.

Reconciliation deserves its own test. The team must verify whether the idempotency key is applied atomically at the destination, what its scope and period are, what happens with divergent parameters and how the system reacts when two receivers attempt the same operation at the same time. If the guarantee is not in force and the evidence does not resolve the uncertainty, the test must confirm that automatic replay stays blocked.

Nexforce states that it maps routines. According to the company, it configures the Nexforce Work and Code agents for complex operational and technical tasks; in the evaluation of an implementation, the contract described here can serve as a working criterion between the responsible teams. The team must verify, in the solution and the integration adopted, the guarantees of persistence, idempotency at the destination and access, without attributing them to the product in advance.

Frequently asked questions

A summary may be correct and still not authorize resumption. The question that decides is another one: what the receiver can check on its own, on its side. Where that check does not exist, the answer stops being yes and becomes an open item.

The evidence hierarchy separates what each layer proves. The internal record shows what the previous session attempted; the accessible artifact shows what the receiver can read now; the authoritative response from the system shows what happened at the destination. Swapping the order of those layers is the error that produces rework: treating a record as proof of effect, or an artifact as proof of authorization. Without a valid idempotency guarantee applied to the effect at the destination, the evidence that decides is the query to the system that produced the effect, with scope, period and result legible to whoever takes over the task. The advantage of the hierarchy is making the doubt locatable: when someone claims that the task is finished, the question becomes which layer holds the evidence that supports the claim, and that answer fits in one sentence.

Does a summary replace the history?

Not necessarily. A summary selects information to guide continuity, while the history records messages according to the storage and the rules of the implementation. If a decision depends on details that may have been left out of the summary, the receiver must consult the accessible source and verify its version before acting.

Does a message between sessions carry the files?

In the communication between sessions described by the source consulted, the message is text and does not automatically attach history or files. Other implementations must be assessed by their own rules. A path mentioned in the message only helps when the receiver has access to the file and confirms that it is reading the correct version.

Does a new session inherit the previous permissions?

That inheritance must not be assumed. In the documented messaging implementation, permissions remain specific to the receiving session. The contract may record known restrictions, but it does not grant authorization. Before reading a source or changing a system, the receiver must verify the available rights and follow the applicable policy.

Does a checkpoint prevent a duplicate send?

Not by itself. The query to the destination may help, but an empty result or a timeout does not prove that the previous send failed or will not complete. Without a valid idempotency guarantee applied at the destination, repetition requires authoritative reconciliation that rules out the previous effect and its future completion. When in doubt, automatic replay is blocked.

References and Further Reading

A reference serves to check a behavior, not to prove that the team's integration carries the same guarantee. The references below describe specific implementations of session, context, transmission and durable execution, and the product page records what Nexforce states it operates.

None of the sources treats persistence, transmission and external effect together. The application fits into three acts: open the cited source, check whether the content matches the accessible file and verify whether the authorization covers the intended reading and execution. The scope stays in the source. When a source leaves a case uncovered, the gap enters the contract as a named risk, and whoever accepts the resumption must know which risk is being accepted. The product page describes routines, which serves as context for the test the team must run. The value is in the resumption flow the team validates, not in the wording of the reference. A concrete case shows the limit: the file cited in the history may be at another version at the destination, and the reference stays silent about which one the receiver will find when opening the path.

Layer 1: what the session stores and transmits

Layer 2: continuity across executions

Layer 3: approval, error and operation

Confirm the next step

The next step is to interrupt a controlled task and ask another session to resume it using only the recorded contract. Order matters. The team starts with the lowest-risk task and checks artifacts, authority and the result at the destination. If any of those points cannot be verified, the work still has an open item, not a conclusion.

The result of the test locates the boundary of responsibility between the runtime that holds the execution and the external system that produces the effect, before a real failure leaves the team without evidence to decide.

Nexforce

Deploy Work and Code Agentswith zero software licensing costs

Automate operational tasks and code writing autonomously with dedicated agents integrated into your systems

Free Trial

Related articles