AgentTraceViewer
The flagship AgentKit component — renders a multi-step agent reasoning trace with collapsible tool calls, per-step timing, and inline JSON inspection for args and results. Drop in any AI SDK v6 step array, or feed the built-in TraceStep[] from your own backend. Static, animated, and live-streaming modes.
src/components/ai/agent-trace-viewer.tsxBasic trace
Three steps — a thought, a tool call, and a final answer. animate={false} (default) renders all steps at once.
With pre-expanded steps
defaultExpandedIndices opens specific rows on first render. Useful for docs or for highlighting a failing step in a debugging view.
// args
{
"from": "JFK",
"to": "HND",
"maxPrice": 1000,
"returnBy": "2026-05-14"
}// result
[{"carrier":"United","price":745,"stops":1}, {"carrier":"ANA","price":812,"stops":0}]Empty state
With no steps yet, the viewer shows the emptyLabel and reserves the full min-height so the surrounding layout doesn't jump when the first step arrives.
Dense multi-step with error
Seven steps across three tool calls ending in an error row. All tool rows are expanded so args and results are readable at a glance.
// args
{
"category": "data-warehouse",
"region": "us-east-1"
}// result
[{"id":"v_901","name":"Snowflake"},{"id":"v_902","name":"BigQuery"},{"id":"v_903","name":"Databricks"}]// args
{
"vendorIds": [
"v_901",
"v_902",
"v_903"
]
}// result
{"v_901":"$2/credit","v_902":"$6.25/TB","v_903":"$0.40/DBU"}// args
{
"vendorIds": [
"v_901",
"v_902",
"v_903"
],
"controls": [
"SOC2",
"HIPAA"
]
}// result
{"v_901":{"SOC2":true,"HIPAA":true},"v_902":{"SOC2":true,"HIPAA":true},"v_903":{"SOC2":true,"HIPAA":false}}// args
{
"to": "vendor@acme.com",
"subject": "Invoice #4412",
"attachments": [
"invoice.pdf"
]
}// result
{"ok":false,"error":"SMTP 421 service not available"}Transient SMTP error. Retry scheduled in 60s.