Phoenix CLI for LLM Trace Debugging

Phoenix CLI for LLM Trace Debugging

Teaches an AI agent to use the Phoenix CLI to fetch traces and spans, debug LLM app failures, and run open and axial coding to build failure taxonomies and decide which evals to write.

Skill files3 files

references/

SKILL.md310 lines
1
---
2
name: phoenix-cli
3
description: Debug LLM applications using the Phoenix CLI. Fetch traces, analyze errors, structure trace review with open coding and axial coding, inspect datasets, review experiments, query annotation configs, and use the GraphQL API. Use whenever the user is analyzing traces or spans, investigating LLM/agent failures, deciding what to do after instrumenting an app, building failure taxonomies, choosing what evals to write, or asking "what's going wrong", "what kinds of mistakes", or "where do I focus" — even without naming a technique.
4
license: Apache-2.0
5
compatibility: Requires Node.js (for npx) or global install of @arizeai/phoenix-cli. Optionally requires jq for JSON processing.
6
metadata:
7
author: arize-ai
8
version: "3.3.0"
9
---
10
11
# Phoenix CLI
12
13
## Invocation
14
15
```bash
16
px <resource> <action> # if installed globally
17
npx @arizeai/phoenix-cli <resource> <action> # no install required
18
```
19
20
The CLI uses singular resource commands with subcommands like `list` and `get`:
21
22
```bash
23
px trace list
24
px trace get <trace-id>
25
px trace annotate <trace-id>
26
px trace add-note <trace-id>
27
px trace-annotations delete
28
px span list
29
px span annotate <span-id>
30
px span add-note <span-id>
31
px span-annotations delete
32
px session list
33
px session get <session-id>
34
px session annotate <session-id>
35
px session add-note <session-id>
36
px session-annotations delete
37
px dataset list
38
px dataset get <name>
39
px project list
40
px project get <name>
41
px annotation-config list
42
px auth status
43
px profile list
44
px profile show [name]
45
px profile create <name>
46
px profile use <name>
47
px profile edit <name>
48
px profile delete <name>
49
```
50
51
## Setup
52
53
```bash
54
export PHOENIX_HOST=http://localhost:6006
55
export PHOENIX_PROJECT=my-project
56
export PHOENIX_API_KEY=your-api-key # if auth is enabled
57
```
58
59
Always use `--format raw --no-progress` when piping to `jq`.
60
61
## Quick Reference
62
63
| Task | Files |
64
| ---- | ----- |
65
| Look at sampled traces, spans, or sessions and write specific notes about what went wrong (no taxonomy yet) | [references/open-coding](references/open-coding.md) |
66
| Group those notes into a structured failure taxonomy and quantify what matters | [references/axial-coding](references/axial-coding.md) |
67
68
Both stages tag every artifact with one shared **coding annotation identifier** (descriptive shape, e.g. `coding-run:chatbot-context-loss-2026-05-06`) so the run is queryable, reversible, and viewable as a unit. Pass `--identifier <value>` explicitly on every `px` call — shell inheritance is unreliable across agent harnesses. Open coding writes notes via `px ... add-note` and records a small local JSONL sidecar at `.px/coding/<sanitized-identifier>.jsonl`; axial coding reads that sidecar as the deterministic handoff and records labels in `.px/coding/<sanitized-identifier>-axial.jsonl`. Pick the identifier once per run (see [references/open-coding.md](references/open-coding.md#coding-annotation-identifier-pick-this-first)), then share the Phoenix UI link from the wrap-up section. Revert is opt-in and runs three identifier-bound DELETEs only after explicit user confirmation.
69
70
> **Workflow term vs. server annotation name.** The skill prose calls this value the **coding annotation identifier** (shell-variable hint: `CODING_ANNOTATION_IDENTIFIER`). The server-side annotation NAME used for the UI filter is unchanged — `coding_session_id` — for data compatibility with rows already written by previous runs. Don't try to rename the server-side annotation; treat the asymmetry as load-bearing.
71
72
## Workflows
73
74
**"What do I do after instrumenting?" / "Where do I focus?" / "What's going wrong?"**
75
[open-coding](references/open-coding.md) → [axial-coding](references/axial-coding.md) → build evals for the top categories.
76
77
## Reference Categories
78
79
| Prefix | Description |
80
| ------ | ----------- |
81
| `references/open-coding` | Free-form notes against sampled traces, spans, or sessions — reach for it whenever the user wants to make sense of LLM traffic but has no failure categories yet. Includes a unit-of-analysis diagnostic so the workflow runs at the level the failure modes actually live at (trace for stateless single-shot calls, session for multi-turn agents, span for mechanical/in-isolation failures). |
82
| `references/axial-coding` | Inductive grouping of notes into a MECE taxonomy with counts — reach for it whenever the user has observations and needs categories or eval targets |
83
84
## Auth
85
86
```bash
87
px auth status # check connection and authentication
88
px auth status --endpoint http://other:6006 # check a specific endpoint
89
px auth status --profile staging # check a named profile's connection
90
```
91
92
## Profiles
93
94
Named profiles let you switch between multiple Phoenix instances (local, staging, cloud) without juggling environment variables. Profiles are stored in `~/.px/settings.json` (or `$XDG_CONFIG_HOME/px/settings.json`).
95
96
Configuration priority (highest to lowest): CLI flags > env vars > active profile > built-in defaults.
97
98
```bash
99
px profile list # list all profiles (shows active profile)
100
px profile show # show the active profile's settings
101
px profile show staging # show a named profile's settings
102
px profile create prod --endpoint https://app.phoenix.arize.com --api-key <key> --activate
103
px profile create local --endpoint http://localhost:6006 --project my-app
104
px profile use prod # switch the active profile
105
px profile edit prod # open profile JSON in $EDITOR (validates on save)
106
px profile delete prod --yes # delete a profile (--yes skips confirmation)
107
```
108
109
Use `--profile <name>` on any command to target a specific profile without changing the active one:
110
111
```bash
112
px trace list --profile staging --limit 10 --format raw --no-progress | jq .
113
px auth status --profile prod
114
```
115
116
`px profile create` options: `--endpoint <url>`, `--project <name>`, `--api-key <key>`, `--header <key=value>` (repeatable), `--activate`.
117
118
## Projects
119
120
```bash
121
px project list # list all projects (table view)
122
px project list --format raw --no-progress | jq '.[].name' # project names as JSON
123
px project get my-project --format raw --no-progress # single record by exact name
124
px project get my-project --format raw --no-progress | jq -r '.id' # extract project id
125
```
126
127
`project get` exits with `ExitCode.FAILURE` (1) on a name miss and writes a `StructuredError` `{error, code: "FAILURE", hint}` to stderr in `--format json|raw`.
128
129
## Traces
130
131
```bash
132
px trace list --limit 20 --format raw --no-progress | jq .
133
px trace list --last-n-minutes 60 --limit 20 --format raw --no-progress | jq '.[] | select(.status == "ERROR")'
134
px trace list --since 2025-01-15T00:00:00Z --limit 50 --format raw --no-progress | jq .
135
px trace list --format raw --no-progress | jq 'sort_by(-.duration) | .[0:5]'
136
px trace list --include-notes --format raw --no-progress | jq '.[].notes'
137
px trace get <trace-id> --format raw | jq .
138
px trace get <trace-id> --format raw | jq '.spans[] | select(.status_code != "OK")'
139
px trace get <trace-id> --include-notes --format raw | jq '.notes'
140
px trace annotate <trace-id> --name reviewer --label pass
141
px trace annotate <trace-id> --name reviewer --score 0.9 --format raw --no-progress
142
px trace annotate <trace-id> --name reviewer --label pass --identifier "<coding-annotation-id>" # tag with a coding annotation identifier
143
px trace add-note <trace-id> --text "needs follow-up"
144
px trace add-note <trace-id> --text "needs follow-up" --identifier "<coding-annotation-id>" # tag + upsert on identifier
145
px trace-annotations delete --identifier "<coding-annotation-id>" --all -y # nuke every annotation tied to this coding annotation identifier
146
```
147
148
`px <entity>-annotations delete` requires `--all` or both `--start-time` and `--end-time` and emits `{deleted: true, target, filter}` on success.
149
150
### Trace JSON shape
151
152
```
153
Trace
154
traceId, status ("OK"|"ERROR"), duration (ms), startTime, endTime
155
annotations[] (with --include-annotations, excludes note)
156
name, result { score, label, explanation }
157
notes[] (with --include-notes)
158
name="note", result { explanation }
159
rootSpan — top-level span (parent_id: null)
160
spans[]
161
name, span_kind ("LLM"|"CHAIN"|"TOOL"|"RETRIEVER"|"EMBEDDING"|"AGENT"|"RERANKER"|"GUARDRAIL"|"EVALUATOR"|"UNKNOWN")
162
status_code ("OK"|"ERROR"|"UNSET"), parent_id, context.span_id
163
notes[] (with --include-notes)
164
name="note", result { explanation }
165
attributes
166
input.value, output.value — raw input/output
167
llm.model_name, llm.provider
168
llm.token_count.prompt/completion/total
169
llm.token_count.prompt_details.cache_read
170
llm.token_count.completion_details.reasoning
171
llm.input_messages.{N}.message.role/content
172
llm.output_messages.{N}.message.role/content
173
llm.invocation_parameters — JSON string (temperature, etc.)
174
exception.message — set if span errored
175
```
176
177
## Spans
178
179
```bash
180
px span list --limit 20 # recent spans (table view)
181
px span list --last-n-minutes 60 --limit 50 # spans from last hour
182
px span list --since 2025-01-15T00:00:00Z --limit 50 # spans since a timestamp
183
px span list --span-kind LLM --limit 10 # only LLM spans
184
px span list --status-code ERROR --limit 20 # only errored spans
185
px span list --name chat_completion --limit 10 # filter by span name
186
px span list --trace-id <id> --format raw --no-progress | jq . # all spans for a trace
187
px span list --parent-id null --limit 10 # only root spans
188
px span list --parent-id <span-id> --limit 10 # only children of a span
189
px span list --include-annotations --limit 10 # include annotation scores
190
px span list --include-notes --limit 10 # include span notes
191
px span list --attribute llm.model_name:gpt-4 --limit 10 # filter by string attribute
192
px span list --attribute llm.token_count.total:500 --limit 10 # filter by numeric attribute
193
px span list --attribute 'user.id:"12345"' --limit 10 # force string match for numeric-looking value
194
px span list --attribute session.id:sess:abc:123 --limit 20 # colon in value OK (split on first colon only)
195
px span list --attribute llm.model_name:gpt-4 --attribute session.id:abc --limit 10 # AND multiple filters
196
px span list output.json --limit 100 # save to JSON file
197
px span list --format raw --no-progress | jq '.[] | select(.status_code == "ERROR")'
198
px span annotate <span-id> --name reviewer --label pass
199
px span annotate <span-id> --name checker --score 1 --annotator-kind CODE
200
px span annotate <span-id> --name reviewer --label pass --identifier "<coding-annotation-id>" # tag with a coding annotation identifier
201
px span add-note <span-id> --text "verified by agent"
202
px span add-note <span-id> --text "verified by agent" --identifier "<coding-annotation-id>" # tag + upsert on identifier
203
px span-annotations delete --identifier "<coding-annotation-id>" --all -y # nuke every annotation tied to this coding annotation identifier
204
```
205
206
### Span JSON shape
207
208
```
209
Span
210
name, span_kind ("LLM"|"CHAIN"|"TOOL"|"RETRIEVER"|"EMBEDDING"|"AGENT"|"RERANKER"|"GUARDRAIL"|"EVALUATOR"|"UNKNOWN")
211
status_code ("OK"|"ERROR"|"UNSET"), status_message
212
context.span_id, context.trace_id, parent_id
213
start_time, end_time
214
attributes
215
input.value, output.value — raw input/output
216
llm.model_name, llm.provider
217
llm.token_count.prompt/completion/total
218
llm.input_messages.{N}.message.role/content
219
llm.output_messages.{N}.message.role/content
220
llm.invocation_parameters — JSON string (temperature, etc.)
221
exception.message — set if span errored
222
annotations[] (with --include-annotations, excludes note)
223
name, result { score, label, explanation }
224
notes[] (with --include-notes)
225
name="note", result { explanation }
226
```
227
228
## Sessions
229
230
```bash
231
px session list --limit 10 --format raw --no-progress | jq .
232
px session list --order asc --format raw --no-progress | jq '.[].session_id'
233
px session list --include-annotations --include-notes --format raw --no-progress | jq '.[].notes'
234
px session get <session-id> --format raw | jq .
235
px session get <session-id> --include-annotations --format raw | jq '.session.annotations'
236
px session get <session-id> --include-notes --format raw | jq '.session.notes'
237
px session annotate <session-id> --name reviewer --label pass
238
px session annotate <session-id> --name reviewer --score 0.9 --format raw --no-progress
239
px session annotate <session-id> --name reviewer --label pass --identifier "<coding-annotation-id>" # tag with a coding annotation identifier
240
px session add-note <session-id> --text "verified by agent"
241
px session add-note <session-id> --text "verified by agent" --identifier "<coding-annotation-id>" # tag + upsert on identifier
242
px session-annotations delete --identifier "<coding-annotation-id>" --all -y # nuke every annotation tied to this coding annotation identifier
243
```
244
245
### Session JSON shape
246
247
```
248
SessionData
249
id, session_id, project_id
250
start_time, end_time
251
token_count_prompt, token_count_completion, token_count_total — cumulative across all LLM spans in the session (int, default 0)
252
annotations[] (with --include-annotations, excludes note)
253
name, result { score, label, explanation }
254
notes[] (with --include-notes)
255
name="note", result { explanation }
256
traces[]
257
id, trace_id, start_time, end_time
258
```
259
260
## Datasets / Experiments / Prompts
261
262
```bash
263
px dataset list --format raw --no-progress | jq '.[].name'
264
px dataset get <name> --format raw | jq '.examples[] | {input, output: .expected_output}'
265
px dataset get <name> --split train --format raw | jq . # filter by split
266
px dataset get <name> --version <version-id> --format raw | jq .
267
px experiment list --dataset <name> --format raw --no-progress | jq '.[] | {id, name, failed_run_count}'
268
px experiment get <id> --format raw --no-progress | jq '.[] | select(.error != null) | {input, error}'
269
px prompt list --format raw --no-progress | jq '.[].name'
270
px prompt get <name> --format text --no-progress # plain text, ideal for piping to AI
271
```
272
273
## Annotation Configs
274
275
```bash
276
px annotation-config list # list all configs (table view)
277
px annotation-config list --format raw --no-progress | jq '.[].name' # config names as JSON
278
```
279
280
## GraphQL
281
282
For ad-hoc queries not covered by the commands above. Output is `{"data": {...}}`.
283
284
```bash
285
px api graphql '{ projectCount datasetCount promptCount evaluatorCount }'
286
px api graphql '{ projects { edges { node { name traceCount tokenCountTotal } } } }' | jq '.data.projects.edges[].node'
287
px api graphql '{ datasets { edges { node { name exampleCount experimentCount } } } }' | jq '.data.datasets.edges[].node'
288
px api graphql '{ evaluators { edges { node { name kind } } } }' | jq '.data.evaluators.edges[].node'
289
290
# Introspect any type
291
px api graphql '{ __type(name: "Project") { fields { name type { name } } } }' | jq '.data.__type.fields[]'
292
```
293
294
Key root fields: `projects`, `datasets`, `prompts`, `evaluators`, `projectCount`, `datasetCount`, `promptCount`, `evaluatorCount`, `viewer`.
295
296
## Docs
297
298
Download Phoenix documentation markdown for local use by coding agents.
299
300
```bash
301
px docs fetch # fetch default workflow docs to .px/docs
302
px docs fetch --workflow tracing # fetch only tracing docs
303
px docs fetch --workflow tracing --workflow evaluation
304
px docs fetch --dry-run # preview what would be downloaded
305
px docs fetch --refresh # clear .px/docs and re-download
306
px docs fetch --output-dir ./my-docs # custom output directory
307
```
308
309
Key options: `--workflow` (repeatable, values: `tracing`, `evaluation`, `datasets`, `prompts`, `integrations`, `sdk`, `self-hosting`, `all`), `--dry-run`, `--refresh`, `--output-dir` (default `.px/docs`), `--workers` (default 10).
310

© arize-ai · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…