---
title: "Create Session"
method: POST
path: "/finetune-agent/sessions"
tags: ["Finetune Agent", "agent-chat-sessions"]
---

# Create Session

`POST /finetune-agent/sessions`

Create a new chat session.

Args:
    request: FastAPI request used by the rate-limiter.
    body: Create payload.
    auth: Authenticated caller.
    service: Chat-session service.

Returns:
    ChatSessionResponse for the created session.

## Request body

- ChatSessionCreate — Request model for creating a chat session.
  - `title` string, nullable — Session title (auto-generated if not provided)
  - `first_message` string, nullable — First user message (used for auto-title generation)
  - `project_id` string, nullable — Optional project ID to scope the session to

## Response `200`

Successful Response

- ChatSessionResponse — Response model for a chat session (without 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. Surfaced for nightly smoke tests and observability — never used for client routing.
  - `first_user_attached_resources` AttachedResourceRef[] — Resource chips the user attached to the *first* user message of this session, parsed from its attached-context preamble. Powers the threads-sidebar preview so users can see at a glance what context a thread was anchored on without opening it. Empty when the session has no user messages or none of them carry a preamble.
    - `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``.

## Other responses

- `422` — Validation Error
- `503` — Session storage timed out before commit; retry is safe.

## Changes

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

[Change history](https://skmtc.dev/pioneer/apis/brain-api/changes/finetune-agent/sessions/post.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)
