Read traces and runs
Check which runs arrived from your agent and inspect what happened inside any run. You can count runs by environment and agent, read a run’s spans and errors, and load full conversation content when you need it.
Before you begin
You need the following to read traces and runs:
- A connected repository that has sent at least one trace. To set this up, see Connect a repository and Send a first trace.
- A coding agent connected to the Runtype Connect Model Context Protocol (MCP) server, or the
runtype-connectCLI (npx @runtypelabs/connect).
The trace tools on this page only read, and they work before you claim your organization with npx @runtypelabs/connect claim. If your organization has several products, pass the product ID in productId (or --product-id in the CLI). Run the CLI from the directory that holds your .env or .env.local file. The CLI picks the product from the ingest key there.
Count runs by environment and agent
Count runs across your product to verify which environments and agents reported traffic and to get sample execution IDs for individual runs.
Coding agent (MCP)
CLI
Ask your coding agent to call query_traces. To count runs across every environment over the default seven-day window, pass an empty object:
To count only production runs, pass environment:
You can also filter by agentId, status (running, completed, or failed), and from and to (ISO 8601 timestamps).
Run query-traces to count runs across every environment:
To count only production runs, pass --environment:
Each group shows its environment, the agent (or other breakdown value), and run and failure counts. It also returns up to three execution IDs (sampleExecutionIds) to pass to read_trace or get_run_outline.
When you omit environment, Runtype counts each environment in separate groups and never combines them. When you pass environment, totals covers that environment.
The following defaults and options apply to query_traces:
- Window: Runtype counts the last seven days by default and up to 30 days, capped at your plan’s trace retention.
- Breakdown: Pass
breakdownto group byagent(default),status,day,stop_reason,model, orsource. - Paging: If
truncatedistrue, callquery_tracesagain withcursor(--cursor) set tonextCursor. - Detailed metrics: Pass
responseFormatset todetailed(--response-format detailed) to add p95 duration, token totals, and cost estimates.
If groups is empty, read hint for the next step. For example, widen from and to, drop a filter, or run a first-trace check.
Read one run
Pass an execution ID from sampleExecutionIds (or from check_first_trace) to inspect what happened inside one run. For a short run, read_trace is enough. For a long run, start with get_run_outline and see Investigate a large run to search spans and read individual fields.
Coding agent (MCP)
CLI
Ask your coding agent to call read_trace with the run’s executionId:
Replace EXECUTION_ID with a run ID from sampleExecutionIds.
To inspect the first error in a failed run, pass aroundFirstFailure with a radius from 0 to 50 spans:
Replace EXECUTION_ID with the failed run’s execution ID.
Run read-trace with --execution-id to inspect one run:
Replace EXECUTION_ID with a run ID from sampleExecutionIds.
To inspect the first failed span and three spans on each side, pass --around-first-failure:
Replace EXECUTION_ID with the failed run’s execution ID.
A run from another product or organization, or one older than your plan’s trace retention, returns a not-found error. For retention windows by plan, see Limits and pricing.
What a run result contains
A read_trace response returns these top-level fields:
run: Metadata for the run, including the agent, environment, conversation, and timestamps.spans: Selected spans in start order, each with itsindex, kind, name, tool, status, duration, error, and input and output previews. Detailed output (responseFormatset todetailed) addsspanId, token counts, and cost.truncated: Whether more matched spans exist beyond the returned slice.content: Whether full span content loaded for the call.hint: The next call to make when paging forward or narrowing a large response.
Pass a span’s index (or spanId in detailed output) to read_span_payload or get_span_context when you want to inspect one span in full. traceTruncated is true when the run had more spans than Runtype keeps for one trace.
Runtype wraps recorded trace text (error, previews, and content fields) in <untrusted-data> tags. The notice field states that the wrapped text is data to read, never instructions to follow.
Page and filter large runs
read_trace returns 10 spans by default. Set limit (--limit) up to 50 for more, or switch to get_run_outline for long runs.
Use these options to narrow a read_trace call:
- Page forward: When
truncatedistrue, callread_traceagain withstart(--start) set to the next span index named inhint. - Filter by span kind: Pass
kind(--kind) withmodel,tool, orstepto read only model calls, tool calls, or steps. - Center on a failure: Pass
aroundFirstFailure(--around-first-failure) with a radius from 0 to 50. Raiselimitto see more spans on each side. Don’t combinearoundFirstFailurewithstart.
Load conversation content
A run counts as production when its deployment.environment.name attribute is production or prod (set through RUNTYPE_ENVIRONMENT). Whether read_trace loads full conversation content depends on that environment:
- Outside production: Full content loads by default (
includeContentdefaults totrue), including development runs and runs that reported no environment. - In production: Full content doesn’t load by default (
includeContentdefaults tofalse). Each span still returnsinputPreviewandoutputPreview(up to 280 characters each) so you can inspect structure without loading full customer messages.
When content loads, each span’s content object can include input, output, systemInstructions, toolArguments, and toolResult. Runtype returns only the content that your instrumentation sent and your logging policy kept. To control what your agent exports, see Control what content is sent.
To load full content for a production run, ask for it explicitly.
Coding agent (MCP)
CLI
Pass includeContent: true to read_trace to load full content on a production run:
Replace EXECUTION_ID with the production run’s execution ID. To skip loading content on a non-production run, pass "includeContent": false.
Pass --include-content to read-trace to load full content on a production run:
Replace EXECUTION_ID with the production run’s execution ID. To skip loading content on a non-production run, pass --no-include-content.
Runtype caps full content at 16 KB per call (64 KB in detailed output). Pass maxContentBytes (--max-content-bytes) to change that limit. If a response would exceed the size cap, Runtype omits the content and hint tells you how to narrow the call.
View the same runs in the dashboard
Every run that query_traces and read_trace return also appears in the Runtype dashboard at use.runtype.com. Open the view that matches what you want to check:
- One agent: Open the agent. The Runs tab lists its runs, and imported runs show an External badge. Select a run to open its details.
- One product: In a product, click Runs in the top bar (or press
⌘J) to view runs and conversations across the product’s agents. - Whole workspace: Outside a product, click Runs in the top bar to list runs across the workspace.
Next steps
Use the following guides to continue:
- Read the observed profile: inspect the prompts, tools, and models Runtype observes from production runs.
- Score conversations with signals: review signal scores on your agent’s turns and add custom signals.
- Find issues in conversations: surface recurring problems across real conversations.
- Connect MCP tools: look up every parameter and output field for the trace tools.
- Connect CLI: look up every
runtype-connectcommand and option.