Notebooks
A
Arize AI
Python Tracing Quickstart

Python Tracing Quickstart

agentsllmsLlamaIndexarize-phoenixopenaitracingtutorialsevalsllmopsai-monitoringaiengineeringprompt-engineeringdatasetsllm-evalai-observabilityllm-evaluationsmolagentsanthropiclangchain

Open In Colab

Phoenix Tracing Tutorial - Support Agent (Python)

This notebook follows along with the Phoenix Tracing Tutorial documentation:

Chapter 1: Your First Traces

Setting Up Tracing

Install Dependencies

[ ]
[ ]

Configure Tracing

[ ]

Tracing LLM Calls

Import libraries and set up the OpenAI client.

[ ]

This is a simple LLM call with tracing. All OpenAI calls are automatically traced

[ ]

Tracing Tool Calls

Set up mock data for the support agent to access.

[ ]

Example query with tool calling. Tools allow your agent to interact with databases, APIs, and external systems.

[ ]

Tracing RAG Pipelines

Helper functions for embeddings and similarity search.

[ ]

Example RAG pipeline with tracing:

[ ]
[ ]

Grouping Operations with Parent Spans

The complete support agent that wraps all operations in a parent span.

[ ]
[ ]

Chapter 2: Annotations and Evaluation

Programmatic Annotations (User Feedback)

Get the Span ID from Running Code

The support agent already captures span IDs. Now we'll collect user feedback and log it to Phoenix.

[ ]

Example: Collect feedback on support agent responses

[ ]

LLM-as-a-Judge Evaluations

Install the Phoenix Evals Package

[ ]

Tool Result Evaluator

Did the tool call succeed or return an error? This is a simple code-based check:

[ ]

Retrieval Relevance Evaluator

Was the retrieved context actually relevant to the question?

[ ]

Log Evaluations to Phoenix

Log all evaluation annotations to Phoenix:

[ ]

Chapter 3: Sessions

Setting Up Sessions

Add Session Tracking to Your Agent

The support agent already supports sessions. Here's how to run multi-turn conversations.

[ ]

Running Multi-Turn Conversations

Run the multi-turn sessions demo to see how conversations are tracked as cohesive units.

[ ]

Session-Level Evaluations

Instead of manually reviewing every session, use LLM-as-Judge evaluation to automatically assess entire conversations. This helps answer questions like: Does the agent remember context? Are issues getting resolved? Where do conversations break down?

Conversation Coherence Evaluator

This evaluator checks if the agent maintained context throughout the conversation:

[ ]

Resolution Evaluator

This evaluator determines if the customer's issue was actually resolved:

[ ]

Running Session Evaluations

Fetch spans from Phoenix, group them by session ID, and evaluate each session:

[ ]

Log Session Annotations

Log all session-level annotations to Phoenix:

[ ]