Session

Agent SDK

Definition

A stateful context in the Agent SDK that maintains conversation history, tool results, and agent state across multiple turns. Sessions can be persisted, resumed, and forked. Session state management is critical for long-running tasks that may span interruptions.

Example Usage

Persist the session ID after each step of a long-running data migration task so it can be resumed if interrupted.