Skip to main content

Phoenix’s Python SDK is modular by design, allowing you to install only what you need. Each package serves a specific purpose and can be used independently or together.

Installation#

Install all packages together or individually based on your needs:

Environment Variables#

All packages respect common Phoenix environment variables for seamless configuration:

VariableDescriptionUsed By
PHOENIX_ENDPOINTPhoenix base URL — canonical for everything except trace exportClient, CLI
PHOENIX_COLLECTOR_ENDPOINTBase Phoenix collector URL or full OTLP trace endpointOTEL (Client and CLI infer from it when PHOENIX_ENDPOINT is unset)
PHOENIX_API_KEYAPI key for authenticationClient, OTEL
PHOENIX_PROJECTDefault project name (canonical)Client, OTEL, CLI
PHOENIX_PROJECT_NAMEAlias for PHOENIX_PROJECT; PHOENIX_PROJECT wins if both are setClient, OTEL
PHOENIX_CLIENT_HEADERSCustom HTTP headersClient, OTEL
PHOENIX_DISCOVER_CONFIGSet to false to disable .env.phoenix credential-file discoveryClient, OTEL, CLI

Phoenix SDKs and the CLI also auto-load PHOENIX_-prefixed settings from a .env.phoenix file, discovered by walking up from the current directory. Process environment variables always take precedence. See Environments.


Phoenix Client#

PyPI Version

The Phoenix Client provides a programmatic interface to the Phoenix platform via its REST API. Use it to manage datasets, run experiments, analyze traces, and collect feedback.

  • Prompts — Create, version, and invoke prompt templates with variable substitution
  • Datasets — Build evaluation datasets from DataFrames, CSV files, or dictionaries
  • Experiments — Run evaluations and track experiment results over time
  • Spans — Query and analyze traces with powerful filtering capabilities
  • Annotations — Add human feedback and automated evaluations to spans
  • Projects — Organize your work across multiple AI applications

Phoenix OTEL#

PyPI Version

Phoenix OTEL provides a lightweight wrapper around OpenTelemetry primitives with Phoenix-aware defaults. It simplifies tracing setup and provides decorators for common GenAI patterns.

  • Zero-config tracing — Enable auto_instrument=True to automatically trace AI libraries
  • Phoenix-aware defaults — Reads PHOENIX_COLLECTOR_ENDPOINT, PHOENIX_API_KEY, and other environment variables
  • Production ready — Built-in batching and authentication support
  • Tracing decorators — @tracer.chain, @tracer.tool, and more for manual instrumentation
  • OpenTelemetry compatible — Works with existing OTel infrastructure

Phoenix Evals#

PyPI Version

Phoenix Evals provides lightweight, composable building blocks for evaluating LLM applications. It includes tools for relevance scoring, faithfulness detection, toxicity checks, and custom metrics.

  • Model adapters — Works with OpenAI, LiteLLM, LangChain, and other providers
  • Pre-built metrics — Faithfulness detection, relevance, toxicity, and more
  • Input mapping — Powerful binding for complex data structures
  • Native instrumentation — OpenTelemetry tracing for observability
  • High performance — Up to 20x speedup with built-in concurrency and batching

OpenInference#

PyPI Version

OpenInference provides instrumentation utilities and helpers for tracing AI applications. Use it alongside Phoenix OTEL for decorators, context managers, and data masking capabilities.

  • Decorators — Use @tracer.agent, @tracer.chain, @tracer.tool to trace custom functions
  • Context managers — Wrap code blocks with using_ helpers for fine-grained control
  • Data masking — Redact sensitive information from traces with built-in masking utilities
  • Framework instrumentors — Auto-trace OpenAI, LangChain, LlamaIndex, Anthropic, and more