Skip to content
Agent Field Notes
Course contentsExpand a topic to choose a lesson.

SYSTEMATIC LEARNING / FOUR-LEVEL COURSE

Reconnecting clients and durable task state

Examine task and connection decoupling, event sequence number, reconnection and clear final state.

Learning objectives: The connection carries progress notifications, and task status is persisted by the backend. Reconnection only restores the observation position. Repeated submission, cancellation and business completion require independent and clear semantics.

Content checked: 2026-10-30 · Each level has independent explanations, tasks and inspections

Choose a starting point based on your familiarity with this topic. Current level: Foundation · Understand the concepts. After completing the task, continue to the next level. Reading and self-checks alone do not establish mastery.

On this level

Review the prerequisites

Suitable for: Backend developers learning Agent applications.

Reconnecting clients and durable task state
The connection carries progress notifications, and task status is persisted by the backend. Reconnection only restores the observation position. Repeated submission, cancellation and business completion require independent and clear semantics.

How does the mechanism work?

Step-by-step explanation
  1. What should I do if the last completed event is lost?

    After separating the task from the stream, handle lost terminal-state notifications.

  2. How to deal with the backlog logs of slow clients?

    Progress persistence also requires resource and retention boundaries.

  3. Should closing the page automatically cancel it?

    A user's connection status does not automatically express an intent to cancel the business operation.

Foundation · Understand the concepts

Derive ownership and invariants

Objectives of this level: Trace a contiguous suffix, gap and terminal marker manually.

Visual guide · Advance only through continuity

Advance only through continuity

A display cursor resumes observation, not business execution. Bind tenant and trace; a gap must not be hidden by jumping to the largest sequence. Select the figure to open it at full size.

The displayed answer and the running task have different identities

A browser refresh loses a connection, not necessarily the durable task. Use a task ID to query execution status, an event cursor to resume presentation, and an operation key to reconcile a business effect. None substitutes for the others.

Suppose the browser has displayed seq=1, “Refund ”. Receiving seq=3 first does not prove seq=2 is empty. Retain the gap and request seq=2. Receiving seq=2 twice should append it once. A done display event means the stream's terminal marker was delivered; it does not independently prove a refund occurred.

This lesson defines application-owned ordered display events. Browser EventSource reconnect behavior and MCP transport lifecycle are separate contracts. In particular, do not transplant an old MCP Last-Event-ID assumption into MCP 2026-07-28; consult the version-migration article.

Continue the same implementation

Use the complete function contract and reproduction commands in the implementation layer. Public cases remain in cases/agent-streaming-resume.json inside the existing extended-agent-practice-v1.zip. These are local fixtures, not remote-model or production-load measurements.

code example

Derive ownership and invariants

The displayed answer and the running task have different identities

A browser refresh loses a connection, not necessarily the durable task. Use a task ID to query execution status, an event cursor to resume presentation, and an operation key to reconcile a business effect. None substitutes for the others.

Suppose the browser has displayed seq=1, “Refund ”. Receiving seq=3 first does not prove seq=2 is empty. Retain the gap and request seq=2. Receiving seq=2 twice should append it once. A done display event means the stream's terminal marker was delivered; it does not independently prove a refund occurred.

This lesson defines application-owned ordered display events. Browser EventSource reconnect behavior and MCP transport lifecycle are separate contracts. In particular, do not transplant an old MCP Last-Event-ID assumption into MCP 2026-07-28; consult the version-migration article.

Acceptance task for this level

For the three inputs, write each output/error by hand and identify the source of trusted facts; explain which expected fields encode business rather than transport success.

Acceptance self-checks

Reading this browser’s record…

Hide the answer and check your understanding

Why are text cursor and business checkpoint different?

Further explanations and practice

When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.

All linked explanations and exercises (1 )

Sources and verification scope

The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.