Skip to content

feat(dashboard): /traces/[id] human-readable conversation walkthrough#15

Merged
OmkarRayAI merged 1 commit into
mainfrom
feat/trace-tree-view
Jun 5, 2026
Merged

feat(dashboard): /traces/[id] human-readable conversation walkthrough#15
OmkarRayAI merged 1 commit into
mainfrom
feat/trace-tree-view

Conversation

@OmkarRayAI

Copy link
Copy Markdown
Owner

Summary

Closes Twitter Q1B: a single page that walks one trace start-to-finish in human-readable form. Previously the dashboard rendered one request at a time; understanding what an agent actually did across N llm_calls, M tool_calls, and nested subagents required clicking through each individually.

What

New route: app/app/(obs)/traces/[id]/page.tsx

  • Header: trace_id + spans count + total latency + total cost + total tokens + session_id + user_id
  • Body: collapsible tree using native HTML <details> (server-rendered, zero client JS). Auto-expands the root and any agent_call; leaves llm_call/tool_call collapsed by default
  • Per-node: kind badge (Agent / LLM / Tool / Action / Retrieve / Judge), label, duration, tokens, cost, start time. agent_call nodes also show subtree rollup (cost + nested-subagent count + descendant llm count)
  • Inline content: prompt and response pulled from attrs.request / attrs.response (Helicone-proxy shape) plus generic fallbacks (input, output, prompt, answer, arg.0, question). 1500-char truncation with scrollable container; full data in the raw JSON drawer
  • Events drawer per span (collapsed by default, first 50)
  • Per-segment grouping: when any span carries session_segment > 0 (PR feat(sdk): session_reset() for mid-conversation segment boundaries #13), roots group into "Initial conversation / After reset Phase 4b: Dashboard cloud mode + sign-in flow #1 / After reset Phase 4c: self-service SaaS — signup, usage metering, docker-compose #2"
  • Error spans: red dot indicator
  • Raw span dump at the bottom for power users

app/lib/traces.ts: exported treeCostFromSpans so the page can decorate agent_call nodes without re-loading spans.

Reuses existing infra

Linked from /agents

Rows on /agents already link to /traces/{trace_id}. With this PR shipped, that link lands on the full conversation walkthrough instead of the wiki-themed engineering view.

Test plan

  • CI green (Python + dashboard typecheck + lint)
  • Run an agent that produces a multi-step trace (examples/decorators_quickstart.py works), open /traces/<id> and verify: tree renders, agent_call rolls up subtree cost, prompts/responses inline, raw JSON at the bottom
  • With wikitrace.session_reset() between turns, verify segment grouping
  • In cloud mode, verify two tenants writing to the same trace_id see only their own spans

Twitter feedback closure

Q Status
1A. Mid-conversation reset (segment boundaries) ✅ PR #13
1B. Human-readable trace tree view ✅ this PR
2. Subagent cost rollup at agent_call level ✅ PR #14

🤖 Generated with Claude Code

Closes Twitter Q1B: a single page that walks one trace start-to-finish
in human-readable form. Previously the dashboard rendered one request
at a time; understanding what an agent actually did across N llm_calls,
M tool_calls, and possibly nested subagents required clicking through
each individually.

What lands

New route: app/app/(obs)/traces/[id]/page.tsx
- Header: trace_id + spans count + total latency + total cost +
  total tokens + session_id + user_id
- Body: collapsible tree using native HTML details elements
  (server-rendered, zero client JS for collapse). Auto-expands
  the root and any agent_call nodes; leaves llm_calls and
  tool_calls collapsed by default for scanability.
- Per-node: kind badge (Agent / LLM / Tool / Action / Retrieve /
  Judge), agent or tool or model label, duration, tokens, cost,
  start time. agent_call nodes also show subtree rollup (cost +
  nested-subagent count + descendant llm count).
- Inline content: pulls prompt and response out of attrs.request
  and attrs.response (Helicone-proxy shape) plus generic fallbacks
  (input, output, prompt, answer, arg.0, question). Truncated to
  1500 chars with a scrollable container; full data is in the raw
  span dump at the bottom.
- Events drawer per span (collapsed by default, first 50 events).
- Per-segment grouping: when any span carries session_segment > 0
  (from PR #13 mid-conversation reset), root spans are grouped
  into Initial conversation / After reset #1 / After reset #2.
- Raw JSON drawer at the bottom for power users.
- Error spans get a red dot indicator.

app/lib/traces.ts
- Exported treeCostFromSpans so the page can decorate agent_call
  nodes with their subtree totals without re-loading spans.

Reuses existing infra
- loadTraceSpansAsync: cloud-mode-aware loader from PR #1.
  Cloud-mode tenants only see their own trace spans.
- treeCostFromSpans: subtree rollup logic from PR #14.
- (obs) layout, glass styling, eyebrow/PageTitle widgets.

Verified
- npx tsc --noEmit clean for all my files
- pytest -q tests/ -> 106 passed, 14 skipped (no regressions)
- Renders correctly against fixtures with nested subagent calls,
  per-span events, error spans, multi-segment sessions, missing
  attrs (defensive fallbacks throughout)

Linked from /agents
- The /agents page rows already link href=/traces/{trace_id}
  (from PR #14). With this PR shipped, that link now lands on the
  full conversation walkthrough instead of the wiki-themed
  engineering view.

This closes the third and largest of the Twitter feedback gaps
(after PR #13 session_reset and PR #14 agent cost rollup).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@OmkarRayAI OmkarRayAI merged commit e541316 into main Jun 5, 2026
4 checks passed
@OmkarRayAI OmkarRayAI deleted the feat/trace-tree-view branch June 5, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant