Skip to main content
In this part, you find the prompt that causes a wrong classification and fix it. At the end, you have two saved versions of the support-classifier prompt, and your code loads the new version. You do these tasks:
  1. Find a failing span in your traces.
  2. Save the original prompt in Prompt Hub.
  3. Edit and test the prompt in the Playground.
  4. Load the edited prompt into your code.
Follow along with code: This guide has a companion notebook with runnable code examples. Find it here.
1

Locate Bad Spans in Traces

In this step, you find the span where the model made a mistake.

Locate bad spans in traces

The tutorial uses a support agent. The agent classifies a customer query, gets the related guidelines, and writes a response. The agent has this pipeline:
In the tutorial notebook, run the “Build and Trace Support Agent” section.Open Phoenix and go to the traces of your project. Click a trace to see the full pipeline.Click the first ChatCompletion span. This is the classification step. The span shows:
  • The system prompt with the list of categories
  • The support query of the user
  • The classification output
Find a wrong classification. In this example, the agent classified the query “calendar sync eats my events” as Technical Bug Report. The correct class is Integration Help, because calendar sync is an integration problem. The classifier must pick the more specific class.
2

Replay Span and Edit Prompt in Playground

In this step, you replay the span in the Playground, edit the prompt, and make sure that the output is correct.

Replay span and edit prompt in Playground

Click Playground. Phoenix opens the span in the Prompt Playground.For all Playground features, see Using the Playground.

Save Original Prompt to Prompt Hub

Save the original prompt before you change it. You use it as the baseline for comparison.In the Playground, click Save Prompt. Type the name support-classifier.

Edit Prompt and Re-Run Span

Make two changes:
  • Add this rule to the prompt:
  • Change the model to GPT-5.
Run the span again. The classification is now correct.

Save Edited Prompt as a New Prompt Version (Version 2)

Save the edited prompt as a new version.Click Save Prompt. Keep the same prompt name, support-classifier.Prompt Hub now shows two versions of the prompt.
3

Load Edited Prompt Back Into Your Code

Load the new prompt version into your code.
For other ways to load a prompt, such as by tag, see Using a prompt.

Summary

You fixed a wrong classification in your agent.
You found the failing span, replayed it in the Playground, and edited the prompt. Prompt Hub keeps both versions of the prompt.

Next Steps

In Test Prompts at Scale, you run the prompt on a full dataset. You measure its accuracy and find the most frequent types of errors.