Link Prompts to Traces
When you fetch a prompt via the XeroML SDK, the SDK automatically records which prompt name and version was used in each trace. This creates a direct link between prompt versions and the traces they produced — letting you compare quality metrics across versions without any manual correlation.
How It Works
The link is established automatically when you:
- Fetch a prompt via
xeroml.get_prompt() - Use the compiled prompt in a traced LLM call (within the same trace context)
XeroML records the prompt name, version number, and label on the generation observation. The trace detail view shows which prompt version was used, and the Prompt detail view shows all traces that used each version.
Viewing Linked Traces
In the XeroML UI:
- Navigate to Prompts and open a prompt
- Select a version
- Click Linked Traces to see all traces where this version was used
- Filter by date range, evaluation score, or other attributes
This gives you a quality breakdown per prompt version — average scores, token costs, and latency by version — without any custom analysis code.
Manual Linking
If you’re not using the SDK to fetch prompts (e.g., you store prompt text elsewhere), you can manually link a trace to a prompt version:
from xeroml import propagate_attributes
with propagate_attributes( prompt_name="my-prompt", prompt_version=5,): # Observations here will be linked to prompt version 5 response = call_llm(compiled_prompt)Use Cases
Prompt regression detection After deploying a new prompt version, filter traces by the new version and compare evaluation scores against the previous version. Catch regressions before they impact all users.
A/B prompt testing
Run two prompt labels in parallel (variant-a, variant-b), fetch each for a random subset of requests, and compare quality metrics across the two groups using the linked traces.
Dataset creation from production Find traces from a specific prompt version that had low scores, and add them to a dataset for targeted improvement experiments.