---
title: "Create agent session"
method: POST
path: "/agent/sessions"
tags: ["agent"]
---

# Create agent session

`POST /agent/sessions`

Creates a new agent session and sends the first message.

## Query parameters

- `remoteNode` string

## Request body

- AgentChatRequest — Request to send a chat message to the agent
  - `message` string, required — User's input text
  - `model` string — LLM model ID to use
  - `dagContexts` AgentDAGContext[] — DAG references for context
    - `dagFile` string, required — DAG file path or name
    - `dagRunId` string — Specific run ID of the DAG
  - `safeMode` boolean — Enable approval prompts for dangerous commands
  - `soulId` string — Soul ID to use for this session (overrides default)
  - `sessionId` string — Optional client-provided session ID (UUID v4) for idempotent creation. Only used by the create-session endpoint; ignored by the chat endpoint.

## Response `201`

Session created

- CreateAgentSessionResponse — Response after creating a new agent session
  - `sessionId` string, required
  - `status` string, required

## Other responses

- `400` — Invalid request
- `401` — Not authenticated
- `503` — Agent not configured
- `default` — Unexpected error

## Changes

- **2026-05-24** (v1) `8a2d5d3e9608` — 4 warning
  - added the new `rate_limited` enum value to the `code` response property for the response status `400`
  - added the new `rate_limited` enum value to the `code` response property for the response status `401`
  - added the new `rate_limited` enum value to the `code` response property for the response status `503`
  - added the new `rate_limited` enum value to the `code` response property for the response status `default`
- **2026-04-30** (v1) `50e1d517afc1` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/dagucloud/apis/dagu/changes/agent/sessions/post.md)

---

[API](https://skmtc.dev/dagucloud/apis/dagu.md) · [All operations](https://skmtc.dev/dagucloud/apis/dagu/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/dagucloud/dagu/revisions/8a2d5d3e9608/schema)
