---
title: "Get Session"
method: GET
path: "/finetune-agent/sessions/{session_id}"
tags: ["Finetune Agent", "agent-chat-sessions"]
---

# Get Session

`GET /finetune-agent/sessions/{session_id}`

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.

## Path parameters

- `session_id` string, uuid, required

## Response `200`

Successful Response

- ChatSessionWithMessages — Response model for a chat session with all messages.
  - `id` string, required
  - `user_id` string, required
  - `title` string, required
  - `created_at` string, required
  - `updated_at` string, required
  - `is_archived` boolean
  - `project_id` string, nullable
  - `modal_sandbox_id` string, nullable — Modal sandbox id for the persistent MLE agent runtime, if a sandbox is associated with this session.
  - `raw_message_tree_present` boolean — 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.
  - `first_user_attached_resources` AttachedResourceRef[] — Resource chips the user attached to the *first* user message of this session, parsed from its attached-context preamble. Mirrors the same field on :class:`ChatSessionResponse` so the agent page header can render the chips next to the session title without scanning every message in ``messages``.
    - `id` string, required — Type-prefixed resource id used by the frontend chip rendering. For example ``dataset:abc-123`` or ``model:tj-99``.
    - `name` string, required — Human-readable label rendered inside the chip.
    - `type` string, required — Resource type slug — one of ``dataset``, ``model``, ``evaluation``, or ``base-model``.
  - `is_turn_active` boolean — 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_attachable` boolean — 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_at` string, 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.
  - `messages` ChatMessageResponse[], required
    - `id` string, required
    - `session_id` string, required
    - `role` string, required
    - `content` string, required
    - `tool_call_id` string, nullable
    - `tool_calls` object[], nullable
    - `images` object[], nullable
    - `is_error` boolean, nullable
    - `message_index` integer, required
    - `created_at` string, required

## Other responses

- `422` — Validation Error

## Changes

- **2026-09-24** `1cffaad2a921` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/pioneer/apis/brain-api/changes/finetune-agent/sessions/:session_id/get.md)

---

[API](https://skmtc.dev/pioneer/apis/brain-api.md) · [All operations](https://skmtc.dev/pioneer/apis/brain-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pioneer/apis/brain-api/revisions/1cffaad2a921?raw)
