Skip to main content
When you ask the Wonder Toys shopping agent to find a toy, you see its answer in the chat. To understand how it reached that answer, you’ll add instrumentation, code that records its model and tool calls so you can inspect them in Phoenix. We’ll start with the uninstrumented Wonder Toys agent, add tracing, and send a shopping request. Then we’ll open its trace in Phoenix to see what happened.
Follow along with Wonder Toys, or use your own agent. For your own agent, use the integration guide for your framework to enable tracing, then send a request and inspect its trace in Phoenix. The setup commands and file paths below are for Wonder Toys.

Before you start

For the Wonder Toys walkthrough, you’ll need: For this walkthrough, we’ll use the LangChain Python version of Wonder Toys, though Phoenix also supports other frameworks. Keep 2 terminals open: one for Phoenix and one for the app.

Step 1: Start Phoenix

If Phoenix is already running, use that instance. Otherwise, start Phoenix locally in the first terminal:
Open the Web UI address shown in the terminal. Phoenix uses http://localhost:6006 by default. Leave Phoenix running for the following steps.

Step 2: Prepare the practice app

With Phoenix running, let’s prepare the app that will send it traces. In the second terminal, get the uninstrumented Wonder Toys app and install its frontend dependencies:
Next, open .env.local to configure the app and tell it where Phoenix is running. Set these values, replacing the key placeholder with your Anthropic key:
If your Phoenix address differs from the example, use it for PHOENIX_COLLECTOR_ENDPOINT. LangChain will record the model calls in Step 3. The Anthropic setting prevents its SDK from recording a second copy. Keep working in no-observability/langchain-py; the file paths below start from this folder.
You can use OpenAI for this lesson if you prefer. Later lessons use Anthropic, so keep the default model if you want to follow those commands unchanged.You can use ChatOpenAI with the same LangChain instrumentation. Add langchain-openai to backend/requirements.txt, then replace the Anthropic key in .env.local with your OpenAI API key:
In backend/agent.py, replace the ChatAnthropic import with:
Replace the entire _build_agent function, including its Anthropic key check, with:
ChatOpenAI reads your OPENAI_API_KEY automatically.

Step 3: Record the model and tool calls

With the app configured, let’s enable auto instrumentation to record its model and tool calls. You can add the setup code yourself or ask a coding assistant to do it.
Add these packages to backend/requirements.txt to record calls and send them to Phoenix:
Then create backend/tracing.py to connect to Phoenix and enable auto instrumentation:
register uses the Phoenix address and project name you set in Step 2.To load this setup before the agent starts, add this import before all other imports in backend/main.py:
We chose tracing.py and _tracer_provider for these lessons; the next lesson reuses those names.

Step 4: Send a shopping request

With tracing in place, start the app from no-observability/langchain-py in the second terminal. If your coding assistant already started it, stop the app before running this command so it loads your changes:
This command runs the startup script, which installs the Python dependencies and starts the app. On its first run, it also downloads the product-search model. When the app is ready, you’ll see its address next to Local in your terminal. Open that address in your browser and send this request:
Wonder Toys in light mode with the dinosaur toy request entered in the chat box and the purple Send button beside it.

Enter the request in the chat box, then select Send.

Wait for the reply, then return to Phoenix. Keep both terminals running.

Step 5: Find your first trace

Now let’s see what happened when the agent handled your request. A trace is the record of one request, from start to finish. Each span records a step within that trace, such as a model call or a tool call.
LangGraph contains an agent step with a model call, a tools step with a tool call, and another agent step with a model call.LangGraph contains an agent step with a model call, a tools step with a tool call, and another agent step with a model call.

LangGraph's agent and tools steps contain the model and tool calls. Each row is a span; other intermediate spans and repeated calls are omitted.

In Phoenix:
  • Open wonder-toys → Traces and select the chat request you just sent, usually named POST /chat or LangGraph.
  • Expand the span tree and find LangGraph, which contains the agent’s workflow.
  • Select a ChatAnthropic model span, or ChatOpenAI if you used that option. Under Info, look for your shopping request in Input and the model’s reply in Output.
  • If the agent searched for products, select search-products to see its arguments and returned products.
Phoenix trace with LangGraph and its child spans visible on the left, ChatAnthropic selected, and the shopper's dinosaur toy request expanded under Info and Input on the right.

Select ChatAnthropic in the span tree to see the shopper's request under Info → Input.

You’ve completed this lesson when you can find your request in a model span and inspect the recorded calls.

Next: Make the complete interaction easier to review

You can now inspect individual model and tool calls. In Add an agent span, you’ll put the shopper’s request and the complete answer together, making it easier to check whether the agent answered what was asked.