phoenix/js/packages/phoenix-cli at main · Arize-ai/phoenix
GitHub
- Immediate Debugging: Fetch the most recent trace of a failed or unexpected run with a single command
- Bulk Export: Export large numbers of traces or experiment results to JSON files for offline analysis
- Dataset & Experiment Access: List datasets and retrieve full experiment data including runs, evaluations, and trace IDs
- Prompt Introspection: View and export prompt templates for analysis, optimization, or use with other tools
- Terminal Workflows: Integrate trace and experiment data into your existing tools, piping output to Unix utilities like
jq - AI Coding Assistants: Use with Claude Code, Cursor, Windsurf, or other AI-powered tools to analyze traces, experiments, and optimize prompts
@arizeai/phoenix-cli is open-source! Issues and PRs welcome.
Installation
Quick Start
Environment Variables
| Variable | Description |
|---|---|
PHOENIX_HOST | Phoenix API endpoint (e.g., http://localhost:6006) |
PHOENIX_PROJECT | Project name or ID |
PHOENIX_API_KEY | API key for authentication (if required) |
PHOENIX_CLIENT_HEADERS | Custom headers as JSON string |
Commands
px projects
List all available projects.
| Option | Description | Default |
|---|---|---|
--endpoint <url> | Phoenix API endpoint | From env |
--api-key <key> | Phoenix API key | From env |
--format <format> | Output format: pretty, json, or raw | pretty |
--no-progress | Disable progress indicators | — |
--limit <number> | Maximum projects to fetch per page | 100 |
px traces [directory]
Fetch recent traces from the configured project.
| Option | Description | Default |
|---|---|---|
[directory] | Save traces as JSON files to directory | stdout |
-n, --limit <number> | Number of traces to fetch (newest first) | 10 |
--last-n-minutes <number> | Only fetch traces from the last N minutes | — |
--since <timestamp> | Fetch traces since ISO timestamp | — |
--endpoint <url> | Phoenix API endpoint | From env |
--project <name> | Project name or ID | From env |
--api-key <key> | Phoenix API key | From env |
--format <format> | pretty, json, or raw | pretty |
--no-progress | Disable progress output | — |
--max-concurrent <number> | Maximum concurrent fetches | 10 |
px trace <trace-id>
Fetch a specific trace by ID.
| Option | Description | Default |
|---|---|---|
--file <path> | Save to file instead of stdout | stdout |
--format <format> | pretty, json, or raw | pretty |
--endpoint <url> | Phoenix API endpoint | From env |
--project <name> | Project name or ID | From env |
--api-key <key> | Phoenix API key | From env |
--no-progress | Disable progress indicators | — |
px sessions
List sessions (multi-turn conversations) for a project.
| Option | Description | Default |
|---|---|---|
-n, --limit <number> | Maximum number of sessions to return | 10 |
--order <order> | Sort order: asc or desc | desc |
--endpoint <url> | Phoenix API endpoint | From env |
--project <name> | Project name or ID | From env |
--api-key <key> | Phoenix API key | From env |
--format <format> | pretty, json, or raw | pretty |
--no-progress | Disable progress indicators | — |
px session <session-id>
View a session’s conversation flow, including all traces (turns) in the session.
| Option | Description | Default |
|---|---|---|
--include-annotations | Include session annotations | Off |
--file <path> | Save to file instead of stdout | stdout |
--format <format> | pretty, json, or raw | pretty |
--endpoint <url> | Phoenix API endpoint | From env |
--project <name> | Project name or ID | From env |
--api-key <key> | Phoenix API key | From env |
--no-progress | Disable progress indicators | — |
px datasets
List all available datasets.
| Option | Description | Default |
|---|---|---|
--endpoint <url> | Phoenix API endpoint | From env |
--api-key <key> | Phoenix API key | From env |
--format <format> | pretty, json, or raw | pretty |
--no-progress | Disable progress indicators | — |
--limit <number> | Maximum number of datasets | — |
px dataset <dataset-identifier>
Fetch examples from a dataset.
| Option | Description | Default |
|---|---|---|
--split <name> | Filter by split (can be used repeatedly) | — |
--version <id> | Fetch from specific dataset version | latest |
--file <path> | Save to file instead of stdout | stdout |
--format <format> | pretty, json, or raw | pretty |
--endpoint <url> | Phoenix API endpoint | From env |
--api-key <key> | Phoenix API key | From env |
--no-progress | Disable progress indicators | — |
px experiments --dataset <name-or-id>
List experiments for a dataset, optionally exporting full data to files.
| Option | Description | Default |
|---|---|---|
--dataset <name-or-id> | Dataset name or ID (required) | — |
[directory] | Export experiment JSON files to directory | stdout |
--endpoint <url> | Phoenix API endpoint | From env |
--api-key <key> | Phoenix API key | From env |
--format <format> | pretty, json, or raw | pretty |
--no-progress | Disable progress indicators | — |
--limit <number> | Maximum number of experiments | — |
px experiment <experiment-id>
Fetch a single experiment with all run data, including inputs, outputs, evaluations, and trace IDs.
| Option | Description | Default |
|---|---|---|
--file <path> | Save to file instead of stdout | stdout |
--format <format> | pretty, json, or raw | pretty |
--endpoint <url> | Phoenix API endpoint | From env |
--api-key <key> | Phoenix API key | From env |
--no-progress | Disable progress indicators | — |
px prompts
List all available prompts.
| Option | Description | Default |
|---|---|---|
--endpoint <url> | Phoenix API endpoint | From env |
--api-key <key> | Phoenix API key | From env |
--format <format> | pretty, json, or raw | pretty |
--no-progress | Disable progress indicators | — |
--limit <number> | Maximum number of prompts | — |
px prompt <prompt_identifier>
Show a Phoenix prompt.
Supports multiple output formats including a text format optimized for piping to AI coding assistants.
| Option | Description | Default |
|---|---|---|
--tag <name> | Get prompt version by tag name | — |
--version <id> | Get specific prompt version by ID | latest |
--format <format> | pretty, json, raw, or text | pretty |
--endpoint <url> | Phoenix API endpoint | From env |
--api-key <key> | Phoenix API key | From env |
--no-progress | Disable progress indicators | — |
text format outputs prompt content with XML-style role tags, ideal for piping to AI assistants:
px api graphql <query>
Make authenticated GraphQL queries against the Phoenix API. Output is {"data": {...}} JSON — pipe with jq '.data.<field>' to extract values. Only queries are permitted; mutations and subscriptions are rejected before hitting the server.
| Argument/Option | Description | Default |
|---|---|---|
<query> | GraphQL query string | — |
--endpoint <url> | Phoenix API endpoint | $PHOENIX_HOST |
--api-key <key> | Phoenix API key | $PHOENIX_API_KEY |
Discover the schema with introspection
Use introspection to explore what fields and types are available without leaving your terminal:Projects
id, name, traceCount, recordCount, tokenCountTotal, tokenCountPrompt, tokenCountCompletion, createdAt, updatedAt.
Datasets
id, name, description, exampleCount, experimentCount, evaluatorCount, createdAt, updatedAt.
Experiments
Experiments are nested under datasets in the GraphQL schema:traceId, output, error, latencyMs, startTime, endTime.
Evaluators
Instance summary
llm.model_name, llm.token_count.*, input.value, output.value, tool.name, and exception.*.
Examples
Debug failed traces
Find slowest traces
Extract LLM models used
Count errors
List datasets and experiments
Analyze experiment results
Work with prompts
Query the GraphQL API directly
Use with AI Coding Assistants
Phoenix CLI is designed to work seamlessly with AI coding assistants like Claude Code, Cursor, and Windsurf.Claude Code
Ask Claude Code:px --help and fetch your traces for analysis.
Prompt Optimization with Claude Code
Pipe your Phoenix prompts directly to Claude Code for analysis and optimization suggestions:Cursor / Windsurf
Run the CLI in the terminal and ask the AI to interpret:Related
Retrieve Traces via CLI
User guide for fetching traces from the command line
@arizeai/phoenix-client
TypeScript client for the Phoenix API

