Phoenix Tracing
GitHubOfficialFirst committed by jimbobbennettDistributed by GitHub
- Skill
- Tool integration
- Data and AI
- Apache-2.0
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Phoenix Tracing provides a structured framework for implementing observability in LLM-based applications. It covers the full lifecycle of trace management, including setup, auto and manual instrumentation, span type definitions, and production deployment. The skill offers specific guidance for both Python and TypeScript environments, enabling developers to capture detailed telemetry for LLM calls, retrieval processes, agent reasoning, and evaluation feedback.
What it does
- Provides setup instructions for Python and TypeScript SDKs.
- Defines OpenInference semantic conventions for various span types like LLM, retriever, and agent.
- Supports both auto-instrumentation and manual custom span creation.
- Enables feedback collection through annotations on traces, spans, documents, and sessions.
- Offers guidance on production concerns such as batch processing and PII masking.
- Facilitates organization of trace data by projects and user sessions.
When to use it
- When you need to implement observability for LLM applications.
- When you want to track multi-step workflows or agent reasoning processes.
- When you need to add custom metadata or feedback annotations to your traces.
- When preparing your LLM application for production monitoring.
- When you need to ensure your instrumentation follows OpenInference standards.
Advantages
- Standardized tracing using OpenInference conventions.
- Supports both Python and TypeScript ecosystems.
- Granular control over span types and custom attributes.
- Built-in support for human, LLM, and code-based feedback annotations.
- Comprehensive documentation for both development and production deployment.
Usage examples
- “How do I set up Phoenix tracing in my Python project?”
- The agent provides the installation steps for the arize-phoenix-otel package and demonstrates how to configure the endpoint to begin capturing traces.
- “How can I add a custom span for an LLM call in TypeScript?”
- The agent guides you through using the @arizeai/phoenix-otel library to wrap your LLM API calls with the appropriate span attributes.
- “How do I add human feedback to a specific span?”
- The agent shows the code pattern for using the client.spans.add_span_annotation method, including how to specify the label, score, and explanation.
- “What are the best practices for production tracing?”
- The agent explains how to implement batch processing and PII masking to ensure efficient and secure trace data collection in a production environment.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/github/phoenix-tracing/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip phoenix-tracing.zip -d .agents/skills
Documentation by jimbobbennett
Phoenix Tracing
Comprehensive guide for instrumenting LLM applications with OpenInference tracing in Phoenix. Contains reference files covering setup, instrumentation, span types, and production deployment.
When to Apply
Reference these guidelines when:
Setting up Phoenix tracing (Python or TypeScript)
Creating custom spans for LLM operations
Adding attributes following OpenInference conventions
Deploying tracing to production
Querying and analyzing trace data
Reference Categories
| Priority | Category | Description | Prefix |
|---|---|---|---|
| 1 | Setup | Installation and configuration | setup-* |
| 2 | Instrumentation | Auto and manual tracing | instrumentation-* |
| 3 | Span Types | 9 span kinds with attributes | span-* |
| 4 | Organization | Projects and sessions | projects-*, sessions-* |
| 5 | Enrichment | Custom metadata | metadata-* |
| 6 | Production | Batch processing, masking | production-* |
| 7 | Feedback | Annotations and evaluation | annotations-* |
Quick Reference
1. Setup (START HERE)
setup-python - Install arize-phoenix-otel, configure endpoint
setup-typescript - Install @arizeai/phoenix-otel, configure endpoint
2. Instrumentation
instrumentation-auto-python - Auto-instrument OpenAI, LangChain, etc.
instrumentation-auto-typescript - Auto-instrument supported frameworks
instrumentation-manual-python - Custom spans with decorators
instrumentation-manual-typescript - Custom spans with wrappers
3. Span Types (with full attribute schemas)
span-llm - LLM API calls (model, tokens, messages, cost)
span-chain - Multi-step workflows and pipelines
span-retriever - Document retrieval (documents, scores)
span-tool - Function/API calls (name, parameters)
span-agent - Multi-step reasoning agents
span-embedding - Vector generation
span-reranker - Document re-ranking
span-guardrail - Safety checks
span-evaluator - LLM evaluation
4. Organization
projects-python / projects-typescript - Group traces by application
sessions-python / sessions-typescript - Track conversations
5. Enrichment
metadata-python / metadata-typescript - Custom attributes
6. Production (CRITICAL)
production-python / production-typescript - Batch processing, PII masking
7. Feedback
annotations-overview - Feedback concepts
annotations-python / annotations-typescript - Add feedback to spans
Reference Files
fundamentals-overview - Traces, spans, attributes basics
fundamentals-required-attributes - Required fields per span type
fundamentals-universal-attributes - Common attributes (user.id, session.id)
fundamentals-flattening - JSON flattening rules
Common Workflows
Quick Start: setup-{lang} → instrumentation-auto-{lang} → Check Phoenix
Custom Spans: setup-{lang} → instrumentation-manual-{lang} → span-{type}
Session Tracking: sessions-{lang} for conversation grouping patterns
Production: production-{lang} for batching, masking, and deployment
How to Use This Skill
Navigation Patterns:
# By category prefix
references/setup-* # Installation and configuration
references/instrumentation-* # Auto and manual tracing
references/span-* # Span type specifications
references/sessions-* # Session tracking
references/production-* # Production deployment
references/fundamentals-* # Core concepts
references/attributes-* # Attribute specifications
# By language
references/*-python.md # Python implementations
references/*-typescript.md # TypeScript implementationsReading Order:
Start with setup-{lang} for your language
Choose instrumentation-auto-{lang} OR instrumentation-manual-{lang}
Reference span-{type} files as needed for specific operations
See fundamentals-* files for attribute specifications
References
Phoenix Documentation:
Python API Documentation:
Python OTEL Package -
arize-phoenix-otelAPI referencePython Client Package -
arize-phoenix-clientAPI reference
TypeScript API Documentation:
TypeScript Packages -
@arizeai/phoenix-otel,@arizeai/phoenix-client, and other TypeScript packages
Files
- ATTRIBUTION.mdAdded by AutoGineer935 B
- LICENSEAdded by AutoGineer10.0 KiB
- README.md842 B
- SKILL.md6.3 KiB
- references/annotations-overview.md3.8 KiB
- references/annotations-python.md3.1 KiB
- references/annotations-typescript.md4.0 KiB
- references/fundamentals-flattening.md1.8 KiB
- references/fundamentals-overview.md1.8 KiB
- references/fundamentals-required-attributes.md2.4 KiB
- references/fundamentals-universal-attributes.md2.3 KiB
- references/instrumentation-auto-python.md2.2 KiB
- references/instrumentation-auto-typescript.md2.2 KiB
- references/instrumentation-manual-python.md4.9 KiB
- references/instrumentation-manual-typescript.md4.6 KiB
- references/metadata-python.md1.8 KiB
- references/metadata-typescript.md1.1 KiB
- references/production-python.md1.5 KiB
- references/production-typescript.md3.5 KiB
- references/projects-python.md1.4 KiB
- references/projects-typescript.md1.1 KiB
- references/sessions-python.md2.3 KiB
- references/sessions-typescript.md5.3 KiB
- references/setup-python.md3.4 KiB
- references/setup-typescript.md3.8 KiB
- references/span-agent.md378 B
- references/span-chain.md1.3 KiB
- references/span-embedding.md2.7 KiB
- references/span-evaluator.md1.6 KiB
- references/span-guardrail.md1.4 KiB
- references/span-llm.md3.0 KiB
- references/span-reranker.md3.2 KiB
- references/span-retriever.md3.4 KiB
- references/span-tool.md2.6 KiB
references/sessions-typescript.md
Sessions (TypeScript)
Track multi-turn conversations by grouping traces with session IDs. Use withSpan directly from @arizeai/openinference-core - no wrappers or custom utilities needed.
Core Concept
Session Pattern:
Generate a unique
session.idonce at application startupExport SESSION_ID, import
withSpanwhere neededUse
withSpanto create a parent CHAIN span withsession.idfor each interactionAll child spans (LLM, TOOL, AGENT, etc.) automatically group under the parent
Query traces by
session.idin Phoenix to see all interactions
Implementation (Best Practice)
1. Setup (instrumentation.ts)
import { register } from "@arizeai/phoenix-otel";
import { randomUUID } from "node:crypto";
// Initialize Phoenix
register({
projectName: "your-app",
url: process.env.PHOENIX_COLLECTOR_ENDPOINT || "http://localhost:6006",
apiKey: process.env.PHOENIX_API_KEY,
batch: true,
});
// Generate and export session ID
export const SESSION_ID = randomUUID();2. Usage (app code)
import { withSpan } from "@arizeai/openinference-core";
import { SESSION_ID } from "./instrumentation";
// Use withSpan directly - no wrapper needed
const handleInteraction = withSpan(
async () => {
const result = await agent.generate({ prompt: userInput });
return result;
},
{
name: "cli.interaction",
kind: "CHAIN",
attributes: { "session.id": SESSION_ID },
}
);
// Call it
const result = await handleInteraction();With Input Parameters
const processQuery = withSpan(
async (query: string) => {
return await agent.generate({ prompt: query });
},
{
name: "process.query",
kind: "CHAIN",
attributes: { "session.id": SESSION_ID },
}
);
await processQuery("What is 2+2?");Key Points
Session ID Scope
CLI/Desktop Apps: Generate once at process startup
Web Servers: Generate per-user session (e.g., on login, store in session storage)
Stateless APIs: Accept session.id as a parameter from client
Span Hierarchy
cli.interaction (CHAIN) ← session.id here
├── ai.generateText (AGENT)
│ ├── ai.generateText.doGenerate (LLM)
│ └── ai.toolCall (TOOL)
└── ai.generateText.doGenerate (LLM)The session.id is only set on the root span. Child spans are automatically grouped by the trace hierarchy.
Querying Sessions
# Get all traces for a session
npx @arizeai/phoenix-cli traces \
--endpoint http://localhost:6006 \
--project your-app \
--format raw \
--no-progress | \
jq '.[] | select(.spans[0].attributes["session.id"] == "YOUR-SESSION-ID")'Dependencies
{
"dependencies": {
"@arizeai/openinference-core": "^2.0.5",
"@arizeai/phoenix-otel": "^0.4.1"
}
}Note: @opentelemetry/api is NOT needed - it's only for manual span management.
Why This Pattern?
Simple: Just export SESSION_ID, use withSpan directly - no wrappers
Built-in:
withSpanfrom@arizeai/openinference-corehandles everythingType-safe: Preserves function signatures and type information
Automatic lifecycle: Handles span creation, error tracking, and cleanup
Framework-agnostic: Works with any LLM framework (AI SDK, LangChain, etc.)
No extra deps: Don't need
@opentelemetry/apior custom utilities
Adding More Attributes
import { withSpan } from "@arizeai/openinference-core";
import { SESSION_ID } from "./instrumentation";
const handleWithContext = withSpan(
async (userInput: string) => {
return await agent.generate({ prompt: userInput });
},
{
name: "cli.interaction",
kind: "CHAIN",
attributes: {
"session.id": SESSION_ID,
"user.id": userId, // Track user
"metadata.environment": "prod", // Custom metadata
},
}
);Anti-Pattern: Don't Create Wrappers
❌ Don't do this:
// Unnecessary wrapper
export function withSessionTracking(fn) {
return withSpan(fn, { attributes: { "session.id": SESSION_ID } });
}✅ Do this instead:
// Use withSpan directly
import { withSpan } from "@arizeai/openinference-core";
import { SESSION_ID } from "./instrumentation";
const handler = withSpan(fn, {
attributes: { "session.id": SESSION_ID }
});Alternative: Context API Pattern
For web servers or complex async flows where you need to propagate session IDs through middleware, you can use the Context API:
import { context } from "@opentelemetry/api";
import { setSession } from "@arizeai/openinference-core";
await context.with(
setSession(context.active(), { sessionId: "user_123_conv_456" }),
async () => {
const response = await llm.invoke(prompt);
}
);Use Context API when:
Building web servers with middleware chains
Session ID needs to flow through many async boundaries
You don't control the call stack (e.g., framework-provided handlers)
Use withSpan when:
Building CLI apps or scripts
You control the function call points
Simpler, more explicit code is preferred
Related
fundamentals-universal-attributes.md- Other universal attributes (user.id, metadata)span-chain.md- CHAIN span specificationsessions-python.md- Python session tracking patterns
Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python
The author says: Requires Phoenix server. Python skills need arize-phoenix-otel; TypeScript skills need @arizeai/phoenix-otel.
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- First committed by
jimbobbennett
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/phoenix-tracing · commit 797337f
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (written by AutoGineer)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- jimbobbennett, stbenjam
AutoGineer is not affiliated with or endorsed by jimbobbennett or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download phoenix-tracing.zip