---
title: "Get Session"
method: GET
path: "/mle-agent/sessions/{session_id}"
tags: ["agent-chat-sessions"]
---

# Get Session

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

Get a specific chat session with all messages.

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, 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
  - `images_retention_days` integer, nullable — Per-session image retention window in days for this chat's image attachments. NULL inherits the 30-day default; 0 means keep forever.
  - `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.
  - `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
    - `message_index` integer, required
    - `created_at` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/pioneer/apis/brain-api.md) · [All operations](https://skmtc.net/pioneer/apis/brain-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pioneer/brain-api/versions/31dfe831e079/schema)
