Skip to content

Add trace visualization to display_sample_record #396

@nabinchha

Description

@nabinchha

Summary

When LLM columns are configured with with_trace=TraceType.ALL_MESSAGES (or LAST_MESSAGE), the resulting __trace columns contain rich conversation history — system prompts, user messages, assistant reasoning, tool calls, tool results, and final answers. Currently, display_sample_record() does not render these traces at all; users must manually iterate and print the raw dicts.

Proposal

Add first-class trace visualization to display_sample_record() with:

  • Rich terminal rendering (works everywhere): Styled panels showing the conversation flow with role-based formatting
  • HTML rendering in Jupyter: Colored block flow diagram with arrows, rendered via IPython.display.HTML (same pattern as image display)
  • include_traces parameter: Shown by default when trace data exists, opt-out via include_traces=False

Design constraints

  • Trace rendering logic should live in a separate module (not crowd visualization.py) — likely a dedicated TraceRenderer class composed into the display flow
  • Trace columns are identified via TRACE_COLUMN_POSTFIX (__trace) from column configs' side_effect_columns
  • Follows the existing section pattern (images, code, validation, judge each get dedicated display sections)

Motivation

Tool-calling / agentic workflows (MCP integration) produce multi-turn traces that are essential for debugging and understanding model behavior. Making these visible in display_sample_record() provides a much better developer experience than raw dict inspection.

Affected files

  • packages/data-designer-config/src/data_designer/config/utils/visualization.py — wire in trace section, add parameter
  • New module for trace rendering logic (e.g., trace_renderer.py in the same utils package)

Something like this:
Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions