uipath-python
uipath-python copied to clipboard
feat: add `uipath trace` CLI command for trajectory visualization
What
Adds a new uipath trace CLI command that visualizes agent execution traces as a Rich tree.
Problem
uipath run --trace-file and uipath eval --trace-file export raw OpenTelemetry spans to JSONL files, but there was no way to view them after the fact — you'd get a wall of JSON.
Solution
# Capture traces
uipath run main '{"query": "hello"}' --trace-file traces.jsonl
# Visualize
uipath trace traces.jsonl
Trace abcdef12…34567890
└── agent (12.5s) ✓
├── input: {"messages": [{"role": "user", "content": "Book a flight..."}]}
├── LLM (gpt-4o) (2.2s) ✓
│ └── tokens: prompt=847, completion=156, total=1003
├── 🔧 search_flights (1.7s) ✓
│ ├── input: {"origin": "SFO", "destination": "NRT"}
│ └── output: {"flights": [...]}
└── 🔧 book_flight (1.2s) ✓
└── output: {"confirmation": {"booking_ref": "BK-UA837"}}
9 spans total
Features
| Flag | Purpose |
|---|---|
| (default) | Span tree with input/output truncated to 200 chars |
--full |
All attributes, no truncation |
--no-input / --no-output |
Structure-only overview |
--name "pattern" |
Filter spans by name (glob) — keeps ancestors |
--contains "pattern" |
Keep full subtrees where any descendant matches |
--span-type TOOL |
Filter by span_type attribute |
--status error |
Filter by span status |
--eval-id "name" |
Pick specific evaluation from verbose eval JSON |
Supported inputs
- JSONL from
uipath run --trace-file/uipath eval --trace-file - JSON from
uipath eval --verbose --output-file
Eval workflow
# Run eval set with tracing
uipath eval main eval-set.json --trace-file traces.jsonl
# Find the eval run where get_random_operator was called
uipath trace traces.jsonl --contains "get_random*"
Changes
- New:
packages/uipath/src/uipath/_cli/cli_trace.py— the command - New:
packages/uipath/tests/cli/trace/— 66 tests + fixtures - Modified:
__init__.py— registeredtracein lazy commands - Modified:
CLI_REFERENCE.md,AGENTS.md,README.md,docs/cli/index.md— documentation