---
title: "Retrieve chat messages for a step"
method: GET
path: "/dag-runs/{name}/{dagRunId}/steps/{stepName}/messages"
tags: ["dag-runs"]
---

# Retrieve chat messages for a step

`GET /dag-runs/{name}/{dagRunId}/steps/{stepName}/messages`

Fetches the LLM chat message history for a chat step. Returns empty array for non-chat steps.

## Path parameters

- `name` string, regex, required — Name of the DAG
- `dagRunId` string, required — Unique identifier for the DAG-run. The special value 'latest' can be used to reference the most recent DAG-run.
- `stepName` string, required

## Query parameters

- `remoteNode` string

## Response `200`

Chat messages retrieved successfully

- ChatMessagesResponse — Response containing chat messages for a step
  - `messages` ChatMessage[], required — List of chat messages
    - `role` 'system' | 'user' | 'assistant' | 'tool', required — Message role in the session
    - `content` string, required — Message content
    - `toolCalls` ChatToolCall[] — Tool calls made by the assistant (only for assistant messages)
      - `id` string, required — Unique identifier for this tool call
      - `name` string, required — Name of the tool being called
      - `arguments` string — JSON string of tool arguments
    - `metadata` ChatMessageMetadata — Metadata about an LLM API call
      - `provider` string — LLM provider (openai, anthropic, gemini, etc.)
      - `model` string — Model identifier used
      - `promptTokens` integer — Number of tokens in the prompt
      - `completionTokens` integer — Number of tokens in the completion
      - `totalTokens` integer — Total tokens (prompt + completion)
  - `toolDefinitions` ToolDefinition[] — Tool definitions that were available to the LLM
    - `name` string, required — Name of the tool
    - `description` string — Description of what the tool does
    - `parameters` object — JSON Schema describing the tool's parameters
  - `stepStatus` 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9, required — Numeric status code indicating current node state: 0: "Not started" 1: "Running" 2: "Failed" 3: "Aborted" 4: "Success" 5: "Skipped" 6: "Partial Success" 7: "Waiting for manual action" 8: "Rejected" 9: "Retrying"
  - `stepStatusLabel` 'not_started' | 'running' | 'failed' | 'aborted' | 'succeeded' | 'skipped' | 'partially_succeeded' | 'waiting' | 'rejected' | 'retrying', required — Human-readable status description for the node
  - `hasMore` boolean, required — True if step is still running and more messages may arrive

## Other responses

- `404` — DAG-run or step not found
- `default` — Generic error response

---

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