Finetune Agent
agent-chat-sessions

Get Session

Get a specific chat session with all messages.

session_id is typed :class:~uuid.UUID so FastAPI answers 422 at the boundary. A raw string such as e2e-session would otherwise reach a Postgres uuid comparison and surface as a driver conversion 500 (PYTHON-1YS7).

Args: request: FastAPI request used by the rate-limiter. session_id: Chat session primary key. auth: Authenticated caller (read-only). service: Chat-session service.

Returns: ChatSessionWithMessages for the owned session.

Raises: HTTPException: 404 when the session is missing or not owned.

get/finetune-agent/sessions/{session_id}

Path parameters

session_idstring uuid required

Response

Successful Response

idstring required
user_idstring required
titlestring required
created_atstring required
updated_atstring required
is_archivedboolean
project_idstring nullable
modal_sandbox_idstring nullable

Modal sandbox id for the persistent MLE agent runtime, if a sandbox is associated with this session.

raw_message_tree_presentboolean

True when the sandbox runtime has persisted a canonical Anthropic message tree for this session. The tree itself is backend-only state (it includes provider request payloads) so we expose only a presence flag that nightly smoke tests can assert on.

is_turn_activeboolean

True when an agent turn is still running for this session. A chat reloaded mid-turn renders a working state and withholds new input instead of looking stalled and inviting a duplicate prompt. Says nothing about whether that turn's live output can be watched — is_turn_attachable is that separate question.

is_turn_attachableboolean

True when the running turn's live output can be rejoined from the replica that served this request, so a WebSocket attach will relay its frames. False while is_turn_active is true means a turn is running that cannot be watched from here: it is either streaming on another replica or is a worker-side continuation turn (ENG-6021) started with no client attached, whose output reaches the client only when it lands in the transcript. Either way the client should keep the composer gated and wait for the transcript rather than expect live frames.

active_turn_started_atstring nullable

When the in-flight turn started, so the UI can show how long it has been running. Null when no turn is active. May be set while is_turn_active is false, which means the stamp is too old to be believed and was left behind by a pod that died mid-turn.

Changes