Agents SDK

Logs

Browse individual chat sessions, inspect every thread, and debug errors from the Logs view.

Overview

The Logs page in the dashboard shows every chat session for the selected agent. Each session contains one or more threads, and you can drill down into any thread to see the full message history, token usage, cost, and duration.

Active streams are highlighted with a real-time indicator, and the view auto-refreshes while threads are streaming.

Session Table

The main view lists all chat sessions for the selected agent.

ColumnDescription
CreatedWhen the chat session started
StatusActive (green) or Error (red) badge based on thread outcomes
Sandbox IDSandbox identifier - click to copy
ThreadsNumber of threads in the session

Filtering & Search

The toolbar above the table provides three ways to narrow your view.

Status Filter

Filter by All, Active, or Error to quickly find conversations that need attention.

Date Range

Presets: Last hour, Last 24 hours, Last 7 days, Last 30 days. Or pick a custom date range with the calendar.

Search

Search by Sandbox ID to find a specific conversation. The search is debounced for performance.

Chat Details

Click any row to open a detail sidebar showing the full chat breakdown.

FieldDescription
Sandbox IDFull sandbox ID (copyable)
AgentName of the agent that handled the session
CreatedSession start timestamp
Total tokensSum of input + output tokens across all threads
Total costAggregate USD cost for the session
Total durationCombined execution time for all threads

Below the summary is a thread table listing every thread with its status, token count, cost, and duration. Click a thread to drill down.

Thread View

The thread detail view shows per-thread metrics and the full conversation replay.

Input tokens

Tokens sent to the model

Output tokens

Tokens generated by the model

Cost

USD cost for this turn

Duration

Execution time in milliseconds

If a thread failed, an error message is displayed in a highlighted block. Below the metrics, you can replay the full conversation including rendered tool calls.

Traces

Every thread records a full execution trace — a tree of spans that shows exactly what the agent did, step by step. Open any thread and switch to the Trace or Timeline tab in the bottom panel.

Trace view

A hierarchical tree of spans. Click any span to see its input, output, duration, token usage, and error details. Spans are color-coded by kind.

AgentToolFunctionLLM

Timeline view

A Gantt-chart-style view showing how spans overlap in time. Useful for spotting slow tool calls, parallel execution, and overall latency breakdown.

Copy as JSON

Both the trace and the chat view have a Copy as JSON button. This exports the full thread data — messages, spans, errors, token counts — as a single JSON object you can paste into a bug report or feed back to an AI assistant to debug faster.

Copy targetIncludes
Chat JSONThread ID, status, duration, cost, token counts, error, and the full message array with roles and parts
Trace JSONThread ID and the complete span tree — each span with its ID, parent, name, kind, status, duration, error, input, output, and attributes
Single spanOne span's full JSON — useful when you need to share a specific tool call or error with your team

Tip: paste the JSON into Claude or another AI assistant along with your agent code to quickly identify and fix errors.

Live Monitoring

When any thread is actively streaming, the toolbar shows a pulsing blue Live indicator. The selected sandbox auto-refreshes every 2 seconds while streams are active.

StatusIndicatorDescription
StreamingBlue pulseThread is actively generating a response
CompletedGreen dotThread finished successfully
ErrorRed dotThread failed with an error
CancelledGray dotThread was stopped by the user

CLI

You can also browse logs directly from the terminal with @21st-sdk/cli logs.

# List recent chats
npx @21st-sdk/cli logs my-agent

# Inspect a specific chat
npx @21st-sdk/cli logs my-agent <chat-id>

# Inspect a specific thread inside a chat
npx @21st-sdk/cli logs my-agent <chat-id> <thread-id>

# Machine-readable output
npx @21st-sdk/cli logs my-agent --json

The command supports the same filters available in the dashboard.

FlagDescription
--status active|errorFilter by chat status
--search TEXTSearch by chat ID or sandbox ID
--since ISOShow chats after this timestamp
--until ISOShow chats before this timestamp
--limit NPage size (1–100)
--jsonOutput as JSON for scripting

See the CLI reference for the full list of commands.

View your logs

Open the dashboard to browse your agent conversations.

Open Logs

What's next

Logs - 21st Agents SDK Docs