Skip to main content
Want your coding agent to do this for you? If you’re using Claude Code, Cursor, Copilot, or another AI coding assistant, try Agent-Assisted Setup to add Phoenix tracing automatically with a single command.
This guide walks through a complete workflow for understanding and improving an agent application using Phoenix. The goal is not just to run an application, but to understand how it behaves, determine whether its outputs are correct, and make changes that can be tested and verified. Each guide in this series introduces one piece of that workflow and builds on the previous one. A trace is a record of a single run of your application, broken down into spans that show what happened at each step (how agents, tasks, and tools executed) and provides the raw data needed for everything that follows. In this guide, you’ll set up tracing and instrument an application: we’ll start a local Phoenix instance, build a simple agent, and send a single trace so you can see the full flow end to end. We’ll use the CrewAI framework in Python, but Phoenix works with many agent frameworks and orchestration libraries. You can find the full list of supported frameworks on our Integrations Page. 

Before We Start

To follow along, you’ll need an OpenAI API key & a Serper Dev Key. We’ll be using OpenAI as our LLM provider & Serper as our Web Search Tool for our chatbot.
Follow along with code: This guide has a companion notebook with runnable code examples. Find it here.

1

Start Phoenix

Before we can send traces anywhere, we need Phoenix running.
Run Phoenix on your own infrastructure, backed by PostgreSQL so traces persist beyond a single process. This is the option to reach for once Phoenix is shared across a team or environment.The self-hosting guide covers Kubernetes, Helm, Railway, AWS CloudFormation, Google Cloud Run, Azure, and Render, plus authentication and configuration.
Phoenix serves its UI and OTLP HTTP on port 6006, and OTLP gRPC on port 4317. For a local instance that’s http://localhost:6006 — leave it running while you work.
2

Configure your Environment

Now that Phoenix is running, we need to connect our application to it so we can start sending traces.In this step, we’ll install the required dependencies and configure a few environment variables. This setup is what allows Phoenix to receive trace data from our application. Once it’s in place, running the application will automatically create a project in the Phoenix UI and record each traced run there.We’ll now install both the CrewAI package and the OpenInference CrewAI auto-instrumentation package, which handles tracing for us without requiring manual instrumentation.

Install Your Packages

Set Your API Keys

Pointing at a deployment with authentication enabled? Set PHOENIX_COLLECTOR_ENDPOINT to that deployment’s hostname and PHOENIX_API_KEY to an API key from its Settings page. A local phoenix serve needs neither.

Register Your Project in Phoenix

Next, we’ll register a tracer provider linked to a project in Phoenix. This project is where your traces will show up in the UI.
At this point, your application is configured to send traces to Phoenix!
3

Create your Agent

Now that Phoenix is running and our environment is configured, we can start building the application so we can generate real execution and send traces to Phoenix.In this step, we’ll create a simple Financial Analysis and Research chatbot. This tutorial we will use CrewAI, but you can build agents in any of these different frameworks for auto-integration with Phoenix.This agent is made up of:
  • Two sub-agents: a Research agent and a Writer agent
  • Two tasks: one for financial research and one for generating a summary report
  • One tool: SerperDevTool for real-time web search

Define the Agents

We’ll start by defining the two agents that make up our crew & the tool the agents may use.

Define the Tasks & Tool

Next, we’ll define the tasks each agent is responsible for.

Create and Run the Crew

Finally, we’ll wire the agents and tasks together and run them sequentially.
At this point, we have a working CrewAI setup with multiple agents, tasks, and a tool. In the next step, we’ll run the crew and see how its execution shows up as a trace in Phoenix!
4

Look at the Trace in Phoenix

Now that we’ve defined our chatbot, all that’s left to do is run it and see what Phoenix captures.To run the agent, execute the following:
Once the run completes, head back to Phoenix and navigate to the Traces view. You should see a new trace corresponding to this run. Click into it to explore how the agents and tasks are executed.At this point, you can follow the full execution of the chatbot as a single trace in Phoenix.More importantly, you can now see how your application actually ran:
  • Which agents were invoked and in what order
  • How tasks flowed from one step to the next
  • Where time was spent across the workflow
This is something you couldn’t see before tracing. Instead of guessing how an agent run behaved or digging through logs, you now have a single, end-to-end view of each execution.Congratulations! You’ve sent your first trace to Phoenix.

Learn More About Traces

You’ve now sent a trace to Phoenix and seen how an agent runs shows up from start to finish. The next step you can take is to run evaluations on your application to start measuring where it is working well and where it needs some iteration to improve performance. Follow along with the Get Started guide for Evals to add even more value to setting up tracing. If you want to focus on tracing and go deeper into just looking at your traces, the Tracing Tutorial walks through how to interpret traces in more detail: including how to read spans, understand timing, and use trace data to debug and analyze your application.