The Complete Production SOP: How to Deploy and Run Arize Phoenix OpenTelemetry RAG Evaluator in Autonomous AI Agents
Step-by-step guide to install & execute the Arize Phoenix OpenTelemetry RAG Evaluator skill in Codex, Claude Code, Cursor, and Windsurf. Free SOP guide.
Technical Overview & Architectural Context
Autonomous coding agents frequently stumble when implementing production Retrieval-Augmented Generation (RAG) pipelines. Without structured observational frameworks, agents routinely hallucinate instrumentations, create conflicting tracer providers, or miss asynchronous OpenTelemetry span flushes. In complex systems using LangChain or LlamaIndex, LLM agents often attempt to evaluate retrieval relevance using crude regex checks or uncalibrated prompt-based judges, failing to capture embedding distance drift, vector projections, and cross-encoder reranking failures. The Arize Phoenix OpenTelemetry RAG Evaluator skill standardizes this workflow by imposing strict procedural boundaries. It enforces deterministic OpenInference semantic conventions, standardizes the instantiation of local Phoenix trace collectors (`phoenix.launch_app()`), and directs agents to benchmark retrieval precision and correctness using calibrated Phoenix Evals. This prevents agents from introducing redundant tracing overhead, writing unmonitored vector queries, or misconfiguring OpenTelemetry span processors in production workloads.
Prerequisites & Environment Requirements
Verified Search Intents & Long-Tail Queries Solved
This operational tutorial is engineered to provide deterministic solutions for these developer search queries:
Step-by-Step Execution Playbook
Local Environment Setup & SKILL.md Mounting
Create the local skill manifest directory and inject verified procedural rules into the agent runtime.
To enable Codex, Claude Code, Cursor, or Windsurf to discover the Arize Phoenix evaluator skill, mount the standard SKILL.md definition into the workspace's agent registry (`.agents/skills/` or `.claude/skills/`). The agent runtime indexes the YAML frontmatter on initialization, wiring triggers like 'trace rag with arize phoenix' directly into the intent parser.
mkdir -p .agents/skills/arize-phoenix-rag-evaluator && curl -fsSL https://askills.dev/api/skills/arize-phoenix-rag-evaluator/raw -o .agents/skills/arize-phoenix-rag-evaluator/SKILL.md---
name: "arize-phoenix-rag-evaluator"
description: "Visualize RAG retrieval trajectories and evaluate relevance using Arize Phoenix."
metadata:
author: "Arize AI"
version: "1.0.0"
runtime_compatibility:
- "codex"
- "claude-code"
- "cursor"
- "windsurf"
triggers:
- "trace rag with arize phoenix"
- "evaluate retrieval precision phoenix"
- "visualize embedding space phoenix"
permissions:
fs_read: true
fs_write: "workspace"
shell_exec: false
net_access: false
---
# Arize Phoenix OpenTelemetry RAG Evaluator
Instruments LLM pipelines with Phoenix OpenTelemetry tracing: inspecting embedding vector projections, evaluating retrieval precision, diagnosing latency bottlenecks, and export to OpenInference.
## When to Invoke
Invoke this skill whenever you need to:
- trace rag with arize phoenix
- evaluate retrieval precision phoenix
- visualize embedding space phoenix
## Execution SOP & Rules
1. Instrument applications with openinference-instrumentation-langchain or llamaindex.
2. Launch local visualization server with phoenix.launch_app() during development.
3. Run benchmark evaluations using phoenix.evals: evaluate QA correctness and hallucination.
4. Export OpenTelemetry traces to enterprise monitoring collectors in production.
## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.Keep the SKILL.md under 150 lines to prevent eating into the agent's active context window while providing exact method signatures.
Ensure the directory permissions allow read access for agent subprocesses, especially when running inside sandboxed Docker or devcontainer environments.
Environment Secrets & Dependency Validation
Inject OpenTelemetry collector variables and install required OpenInference dependencies.
Phoenix can run as a local embedded server or route traces to a remote Arize collector via standard OTLP/gRPC. The agent must verify that Python dependencies (`arize-phoenix`, `openinference-instrumentation-*`, and `opentelemetry-sdk`) are locked in `pyproject.toml` or `requirements.txt` without injecting hardcoded credentials.
pip install --upgrade arize-phoenix openinference-instrumentation-langchain opentelemetry-sdk && echo 'PHOENIX_PORT=6006' >> .env.localimport phoenix as px
from openinference.instrumentation.langchain import LangChainInstrumentor
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from openinference.instrumentation import OTLPSpanExporter
def setup_phoenix_tracing(local_ui: bool = True):
"""Initializes OpenInference tracing and mounts Arize Phoenix collector."""
if local_ui:
session = px.launch_app(port=6006)
print(f"Phoenix UI accessible at {session.url}")
# Register LangChain auto-instrumentation
LangChainInstrumentor().instrument()
return True
if __name__ == '__main__':
setup_phoenix_tracing()Never put API tokens or production collector endpoints directly into code; consume them strictly via PHOENIX_COLLECTOR_ENDPOINT and ARIZE_API_KEY environment variables.
Calling LangChainInstrumentor().instrument() multiple times inside hot-reloading servers (e.g., FastAPI, Streamlit) duplicates spans and inflates memory consumption.
Intent Matching & Trigger Invocation
Verify deterministic activation using tested natural language prompts in your agent runtime.
Once mounted, the agent matches triggers such as 'trace rag with arize phoenix' or 'evaluate retrieval precision phoenix'. Use explicit domain terminology in prompts to guide the agent directly to the evaluation pipeline logic rather than general debugging routines.
echo 'Run: evaluate retrieval precision phoenix on tests/fixtures/rag_queries.json' | claudeimport pandas as pd
import phoenix as px
from phoenix.evals import (RAG_RELEVANCY_PROMPT_TEMPLATE, llm_classify, OpenAIModel)
def evaluate_retrieval(query_df: pd.DataFrame):
"""Evaluates retrieval precision against OpenInference trace exports."""
eval_model = OpenAIModel(model_name="gpt-4o-mini")
relevance_eval = llm_classify(
dataframe=query_df,
template=RAG_RELEVANCY_PROMPT_TEMPLATE,
model=eval_model,
rails=["relevant", "irrelevant"],
provide_explanation=True
)
px.log_evaluations(relevance_eval)
return relevance_evalUse concise phrasing matching the frontmatter triggers to minimize LLM inference routing tokens.
Avoid vague instructions like 'look at my vectors'; prompt with 'visualize embedding space phoenix' to trigger correct vector dimension mapping steps.
Verification, Linting & Output Quality Gate
Execute automated self-healing checks and run integration tests before closing the task.
Autonomous agents must confirm that tracing spans export cleanly with return code 0, and that no uncommitted trace artifacts clutter the workspace repository. The skill instructs the agent to run unit tests and verify the local Phoenix HTTP endpoint responds.
pytest tests/test_rag_pipeline.py && curl -sI http://localhost:6006 | grep '200 OK'#!/usr/bin/env bash
set -euo pipefail
# Run unit tests validating trace span generation
python -m unittest discover -s tests
# Check if Phoenix application endpoint is active
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:6006 || echo "500")
if [ "$STATUS_CODE" != "200" ]; then
echo "Warning: Phoenix server not responding on port 6006"
fi
echo "Verification completed successfully."Always inspect the git diff before accepting the agent's modifications to ensure telemetry listeners do not intercept sensitive user inputs in cleartext.
If tests run in an isolated CI container without networking, set PHOENIX_PORT=-1 or bypass `px.launch_app()` to avoid container port bind failures.
Real-World Scenario: Instrumenting a LangChain QA System and Benchmarking Retrieval Relevancy
“Please instrument our LangChain RAG pipeline in rag_service.py to trace rag with arize phoenix and evaluate retrieval precision phoenix against our validation dataset in data/eval_set.json.”
Runtime Troubleshooting & Failure Modes
Root Cause: A previous instance of the Phoenix visualization server or another local debugging process is already running on port 6006.
lsof -ti:6006 | xargs kill -9 || export PHOENIX_PORT=6007Root Cause: Conflicting versions of opentelemetry-sdk or unmanaged global TracerProvider initializations overriding OpenInference auto-instrumentation.
pip install --upgrade 'opentelemetry-api>=1.20.0' 'opentelemetry-sdk>=1.20.0' 'openinference-instrumentation-langchain>=0.1.15'Frequently Asked Questions (Arize Phoenix OpenTelemetry RAG Evaluator SOP)
Q:Can I use Arize Phoenix OpenTelemetry RAG Evaluator across Codex, Claude Code, and Cursor simultaneously?
Yes. The skill conforms to the universal SKILL.md specification. When placed in the appropriate skills registry or repository root, Codex, Claude Code, Cursor, and Windsurf parse the frontmatter triggers and adopt the same deterministic SOP.
Q:How does Arize Phoenix OpenTelemetry RAG Evaluator prevent context window overflow during long agent sessions?
The skill provides concise, modular SOP rules and pre-defined code interfaces instead of dumping lengthy documentation into system prompts. Traces are inspected programmatically via Phoenix evaluation scripts rather than feeding raw logs back into LLM memory.
Q:Does this skill require escalated root or container permissions?
No. The skill is audited with a security score of 98/100. It requires only standard workspace file read/write access and normal user execution permissions for local Python runtime environments.
Ready to equip your autonomous agent with Arize Phoenix OpenTelemetry RAG Evaluator?
Copy the complete audited SKILL.md specification or download the 1-click zip bundle directly from our verified registry.