sessions
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| ArchiveSessionRequest aclientp.schema.v2.sessions **UNSTABLE**: Request parameters for archiving a session. |
||
| ArchiveSessionResponse aclientp.schema.v2.sessions **UNSTABLE**: Response from archiving a session. |
||
| CancelSessionNotification aclientp.schema.v2.sessions Notification to cancel a session's foreground work and its prompts not yet inserted. |
||
| CloseSessionRequest aclientp.schema.v2.sessions Request parameters for closing an active session. |
||
| CloseSessionResponse aclientp.schema.v2.sessions Response from closing a session. |
||
| DeleteSessionRequest aclientp.schema.v2.sessions Request parameters for deleting an existing session from ``session/list``. |
||
| DeleteSessionResponse aclientp.schema.v2.sessions Response from deleting a session. |
||
| ForkSessionRequest aclientp.schema.v2.sessions **UNSTABLE**: Request parameters for forking an existing session. |
||
| ForkSessionResponse aclientp.schema.v2.sessions **UNSTABLE**: Response from forking an existing session. |
||
| ListSessionsRequest aclientp.schema.v2.sessions Request parameters for listing existing sessions. |
||
| ListSessionsResponse aclientp.schema.v2.sessions Response from listing sessions. |
||
| NewSessionRequest aclientp.schema.v2.sessions Request parameters for creating a new session. |
||
| NewSessionResponse aclientp.schema.v2.sessions Response from creating a new session. |
||
| ReplayFromStart aclientp.schema.v2.sessions Replay all retained conversation history from its first replayable entry. |
||
| ResumeSessionRequest aclientp.schema.v2.sessions Request parameters for resuming an existing session. |
||
| ResumeSessionResponse aclientp.schema.v2.sessions Response from resuming an existing session. |
||
| SessionInfo aclientp.schema.v2.sessions Information about a session returned by ``session/list``. |
||
| SessionOptionsRequest aclientp.schema.v2.sessions **UNSTABLE**: Parameters of ``session/options``. |
||
| SessionOptionsResponse aclientp.schema.v2.sessions **UNSTABLE**: Response from ``session/options``. |
||
| SessionStatusRequest aclientp.schema.v2.sessions **UNSTABLE**: Request parameters for checking the status of a session. |
||
| SessionStatusResponse aclientp.schema.v2.sessions **UNSTABLE**: Response from checking the status of a session. |
||
| SetSessionTitleRequest aclientp.schema.v2.sessions **UNSTABLE**: Request parameters for setting the title of a session. |
||
| SetSessionTitleResponse aclientp.schema.v2.sessions **UNSTABLE**: Response from setting the title of a session. |
||
| SystemPrompt aclientp.schema.v2.sessions Client-provided system-level instructions for a session. |
||
| UnarchiveSessionRequest aclientp.schema.v2.sessions **UNSTABLE**: Request parameters for unarchiving a session. |
||
| UnarchiveSessionResponse aclientp.schema.v2.sessions **UNSTABLE**: Response from unarchiving a session. |
||
| UnknownReplayFrom aclientp.schema.v2.sessions A custom or future replay cursor; ``type`` values starting with ``_`` are extensions. |
🛈 DocStrings¶
v2 session lifecycle: create, resume, fork, close, list and manage sessions.
session/load is gone in v2: session/resume covers both resuming without
replay and full replay, selected with replayFrom.
ReplayFrom
module-attribute
¶
ReplayFrom = Annotated[
Annotated[ReplayFromStart, Tag("start")] | Annotated[UnknownReplayFrom, Tag(OTHER_TAG)],
Discriminator(open_discriminator("type", frozenset({"start"}))),
]
Inclusive cursor of where replayed history begins on session/resume.
SessionArchiveFilter
module-attribute
¶
UNSTABLE: Which sessions session/list returns by archive state (default exclude).
SessionStatus
module-attribute
¶
UNSTABLE: Whether the agent has a session in memory (open) or can resume it (saved).
Clients MUST treat unknown values as saved.
SystemPromptMode
module-attribute
¶
How the agent combines a client-provided system prompt with its own instructions.
Every agent with the systemPrompt capability supports append; override
needs session.systemPrompt.mode.override. Values starting with _ are extensions.
ArchiveSessionRequest
¶
Bases: AnnotatedObject
UNSTABLE: Request parameters for archiving a session.
Source code in src/aclientp/schema/v2/sessions.py
ArchiveSessionResponse
¶
Bases: AnnotatedObject
UNSTABLE: Response from archiving a session.
Source code in src/aclientp/schema/v2/sessions.py
CancelSessionNotification
¶
Bases: AnnotatedObject
Notification to cancel a session's foreground work and its prompts not yet inserted.
Source code in src/aclientp/schema/v2/sessions.py
CloseSessionRequest
¶
Bases: AnnotatedObject
Request parameters for closing an active session.
Source code in src/aclientp/schema/v2/sessions.py
CloseSessionResponse
¶
Bases: AnnotatedObject
Response from closing a session.
Source code in src/aclientp/schema/v2/sessions.py
DeleteSessionRequest
¶
Bases: AnnotatedObject
Request parameters for deleting an existing session from session/list.
Source code in src/aclientp/schema/v2/sessions.py
DeleteSessionResponse
¶
Bases: AnnotatedObject
Response from deleting a session.
Source code in src/aclientp/schema/v2/sessions.py
ForkSessionRequest
¶
Bases: AnnotatedObject
UNSTABLE: Request parameters for forking an existing session.
Source code in src/aclientp/schema/v2/sessions.py
additional_directories
class-attribute
instance-attribute
¶
additional_directories: Sequence[AbsolutePath] | MISSING = MISSING
Additional workspace roots to activate for this session. Each path must be absolute.
config_options
class-attribute
instance-attribute
¶
config_options: Sequence[InitialSessionConfigOption] | MISSING = MISSING
Initial values for the forked session's config options.
cursor_id
class-attribute
instance-attribute
¶
cursor_id: CursorId | MISSING | None = MISSING
The session cursor to fork at. The new session's history is the source session's history before the cursor.
cwd
instance-attribute
¶
cwd: AbsolutePath
The working directory for this session. Must be an absolute path.
mcp_servers
class-attribute
instance-attribute
¶
mcp_servers: Sequence[McpServer] | MISSING = MISSING
List of MCP servers to connect to for this session.
system_prompt
class-attribute
instance-attribute
¶
system_prompt: SystemPrompt | MISSING | None = MISSING
System-level instructions for the forked session.
ForkSessionResponse
¶
Bases: AnnotatedObject
UNSTABLE: Response from forking an existing session.
Source code in src/aclientp/schema/v2/sessions.py
available_commands
class-attribute
instance-attribute
¶
available_commands: Sequence[AvailableCommand] | MISSING = MISSING
Initial commands the agent can execute in this session.
config_options
class-attribute
instance-attribute
¶
config_options: Sequence[SessionConfigOption] | MISSING = MISSING
Initial session configuration options.
ListSessionsRequest
¶
Bases: AnnotatedObject
Request parameters for listing existing sessions.
Source code in src/aclientp/schema/v2/sessions.py
archived
class-attribute
instance-attribute
¶
archived: SessionArchiveFilter | MISSING | None = MISSING
Filter sessions by archive state.
cursor
class-attribute
instance-attribute
¶
cursor: SessionListCursor | MISSING | None = MISSING
Opaque cursor token from a previous response's nextCursor field for cursor-based pagination
cwd
class-attribute
instance-attribute
¶
cwd: AbsolutePath | MISSING | None = MISSING
Filter sessions by working directory. Must be an absolute path.
ListSessionsResponse
¶
Bases: AnnotatedObject
Response from listing sessions.
Source code in src/aclientp/schema/v2/sessions.py
next_cursor
class-attribute
instance-attribute
¶
next_cursor: SessionListCursor | MISSING | None = MISSING
Opaque cursor token. If present, pass this in the next request's cursor parameter to fetch the next page. An empty string is a valid cursor, not the end of results.
NewSessionRequest
¶
Bases: AnnotatedObject
Request parameters for creating a new session.
Source code in src/aclientp/schema/v2/sessions.py
additional_directories
class-attribute
instance-attribute
¶
additional_directories: Sequence[AbsolutePath] | MISSING = MISSING
Additional workspace roots for this session. Each path must be absolute.
config_options
class-attribute
instance-attribute
¶
config_options: Sequence[InitialSessionConfigOption] | MISSING = MISSING
Initial values for the session's config options.
cwd
instance-attribute
¶
cwd: AbsolutePath
The working directory for this session. Must be an absolute path.
mcp_servers
class-attribute
instance-attribute
¶
mcp_servers: Sequence[McpServer] | MISSING = MISSING
List of MCP (Model Context Protocol) servers the agent should connect to.
system_prompt
class-attribute
instance-attribute
¶
system_prompt: SystemPrompt | MISSING | None = MISSING
System-level instructions for the new session.
NewSessionResponse
¶
Bases: AnnotatedObject
Response from creating a new session.
New sessions are idle until a state_update says otherwise.
Source code in src/aclientp/schema/v2/sessions.py
available_commands
class-attribute
instance-attribute
¶
available_commands: Sequence[AvailableCommand] | MISSING = MISSING
Initial commands the agent can execute in this session.
config_options
class-attribute
instance-attribute
¶
config_options: Sequence[SessionConfigOption] | MISSING = MISSING
Initial session configuration options.
ReplayFromStart
¶
Bases: AnnotatedObject
Replay all retained conversation history from its first replayable entry.
Source code in src/aclientp/schema/v2/sessions.py
ResumeSessionRequest
¶
Bases: AnnotatedObject
Request parameters for resuming an existing session.
Source code in src/aclientp/schema/v2/sessions.py
additional_directories
class-attribute
instance-attribute
¶
additional_directories: Sequence[AbsolutePath] | MISSING = MISSING
Additional workspace roots to activate for this session. Each path must be absolute.
config_options
class-attribute
instance-attribute
¶
config_options: Sequence[InitialSessionConfigOption] | MISSING = MISSING
Initial values for the session's config options.
cwd
instance-attribute
¶
cwd: AbsolutePath
The working directory for this session. Must be an absolute path.
mcp_servers
class-attribute
instance-attribute
¶
mcp_servers: Sequence[McpServer] | MISSING = MISSING
List of MCP servers to connect to for this session.
replay_from
class-attribute
instance-attribute
¶
replay_from: ReplayFrom | MISSING | None = MISSING
Inclusive cursor describing where conversation replay should begin.
system_prompt
class-attribute
instance-attribute
¶
system_prompt: SystemPrompt | MISSING | None = MISSING
System-level instructions for the resumed session.
ResumeSessionResponse
¶
Bases: AnnotatedObject
Response from resuming an existing session.
The agent sends a current state_update after any requested replay (ended by
replay_complete) and before this response.
Source code in src/aclientp/schema/v2/sessions.py
available_commands
class-attribute
instance-attribute
¶
available_commands: Sequence[AvailableCommand] | MISSING = MISSING
Initial commands the agent can execute in this session.
config_options
class-attribute
instance-attribute
¶
config_options: Sequence[SessionConfigOption] | MISSING = MISSING
Initial session configuration options.
SessionInfo
¶
Bases: AnnotatedObject
Information about a session returned by session/list.
Source code in src/aclientp/schema/v2/sessions.py
additional_directories
class-attribute
instance-attribute
¶
additional_directories: Sequence[AbsolutePath] | MISSING = MISSING
Additional workspace roots reported for this session. Each path must be absolute.
archived
class-attribute
instance-attribute
¶
Whether the session is archived.
cwd
instance-attribute
¶
cwd: AbsolutePath
The working directory for this session. Must be an absolute path.
title
class-attribute
instance-attribute
¶
Human-readable title for the session
updated_at
class-attribute
instance-attribute
¶
RFC 3339 timestamp of last activity.
SessionOptionsRequest
¶
Bases: AnnotatedObject
UNSTABLE: Parameters of session/options.
Returns the config options a session would start with, without creating or resuming one.
Source code in src/aclientp/schema/v2/sessions.py
additional_directories
class-attribute
instance-attribute
¶
additional_directories: Sequence[AbsolutePath] | MISSING = MISSING
Additional workspace roots to resolve options for. Each path must be absolute.
cwd
instance-attribute
¶
cwd: AbsolutePath
The working directory to resolve options for. Must be an absolute path.
SessionOptionsResponse
¶
Bases: AnnotatedObject
UNSTABLE: Response from session/options.
Source code in src/aclientp/schema/v2/sessions.py
available_commands
class-attribute
instance-attribute
¶
available_commands: Sequence[AvailableCommand] | MISSING = MISSING
Commands the Agent knows the session would have.
config_options
class-attribute
instance-attribute
¶
config_options: Sequence[SessionConfigOption] | MISSING = MISSING
The config options the session would start with, with the same rules as on
NewSessionResponse.
SessionStatusRequest
¶
Bases: AnnotatedObject
UNSTABLE: Request parameters for checking the status of a session.
Source code in src/aclientp/schema/v2/sessions.py
SessionStatusResponse
¶
Bases: AnnotatedObject
UNSTABLE: Response from checking the status of a session.
Source code in src/aclientp/schema/v2/sessions.py
state
class-attribute
instance-attribute
¶
state: StateUpdate | MISSING | None = MISSING
The session's current foreground state, as the same snapshot the Agent sends in
state_update notifications.
SetSessionTitleRequest
¶
Bases: AnnotatedObject
UNSTABLE: Request parameters for setting the title of a session.
Source code in src/aclientp/schema/v2/sessions.py
SetSessionTitleResponse
¶
Bases: AnnotatedObject
UNSTABLE: Response from setting the title of a session.
Source code in src/aclientp/schema/v2/sessions.py
SystemPrompt
¶
Bases: AnnotatedObject
Client-provided system-level instructions for a session.
Only sent when the agent advertises session.systemPrompt; agents that cannot apply
it return an error instead of creating the session.
Source code in src/aclientp/schema/v2/sessions.py
content
class-attribute
instance-attribute
¶
content: Sequence[ContentBlock] = Field(min_length=1)
The system prompt content; at least one block.
mode
instance-attribute
¶
mode: SystemPromptMode
How the Agent combines content with its own instructions.
UnarchiveSessionRequest
¶
Bases: AnnotatedObject
UNSTABLE: Request parameters for unarchiving a session.
Source code in src/aclientp/schema/v2/sessions.py
UnarchiveSessionResponse
¶
Bases: AnnotatedObject
UNSTABLE: Response from unarchiving a session.