Lightweight tracing SDK for LLM-powered agents with Phoenix integration
Project description
ateam-llm-tracer
Lightweight tracing SDK for LLM-powered agents. Instrument once, evaluate continuously.
Built on OpenInference and OpenTelemetry, ships to Phoenix out of the box.
Installation
pip install ateam-llm-tracer
Quick Start
from ateam_llm_tracer import init_tracing, Tracer
# Initialize once at application startup
init_tracing(
project_name="my-agent-project",
service_name="my-agent",
phoenix_endpoint="https://phoenix.internal.a.team",
)
# Create a tracer scoped to your task
tracer = Tracer(task="nl-to-sql")
# Trace an LLM call
with tracer.start_llm_span("generate-query") as span:
span.set_input(user_question)
span.set_model("claude-sonnet-4-20250514")
response = llm.complete(user_question)
span.set_output(response.content)
span.set_token_counts(
prompt=response.usage.input_tokens,
completion=response.usage.output_tokens
)
span.mark_success()
Features
- Zero-config start: Sensible defaults, single line to enable
- Minimal code changes: Decorators and context managers
- Phoenix-native: Built on OpenTelemetry + OpenInference
- Span kinds: LLM, Agent, Tool, Chain, Retriever, and more
- Status tracking: Success, failure, partial completion
- Signal mapping: Connect user feedback to traces
Span Kinds
LLM: Direct model inferenceAGENT: Agentic loops with iterationsTOOL: Tool/function executionCHAIN: Multi-step workflowsRETRIEVER: RAG retrievalEMBEDDING: Embedding generationRERANKER: Reranking operationsGUARDRAIL: Safety/validation checks
Configuration
Configure via environment variables or code:
# Environment variables
export CONTROL_ROOM_TRACING_ENABLED=true
export CONTROL_ROOM_TRACING_ENDPOINT=https://phoenix.internal.a.team
export CONTROL_ROOM_TRACING_SERVICE=my-agent
export CONTROL_ROOM_TRACING_SAMPLE_RATE=1.0
Or in code:
from ateam_llm_tracer import TracingConfig, init_tracing
config = TracingConfig(
enabled=True,
phoenix_endpoint="https://phoenix.internal.a.team",
service_name="my-agent",
sample_rate=1.0,
)
init_tracing(project_name="my-agent-project", config=config)
Examples
Agentic Loop
tracer = Tracer(task="research-query")
with tracer.start_agent_span("research-loop") as agent_span:
agent_span.set_input(query)
for i in range(10):
agent_span.set_iteration(i + 1)
with tracer.start_llm_span("plan") as llm_span:
llm_span.set_model("claude-sonnet-4")
response = llm.complete(messages)
llm_span.set_output(response)
llm_span.mark_success()
if response.stop_reason == "end_turn":
agent_span.set_output(response.content)
agent_span.mark_success()
break
Tool Execution
with tracer.start_tool_span("database-query") as span:
span.set_tool_name("execute_sql")
span.set_tool_parameters({"query": sql_query})
result = execute_sql(sql_query)
span.set_tool_result(result)
span.mark_success()
User Feedback
The library provides a flexible signal recording system that captures user interactions without imposing interpretation:
from ateam_llm_tracer import record_signal, SignalType
# Record user signals (default: no quality scores, just facts)
record_signal(
span_id=artifact.span_id,
signal=SignalType.THUMBS_UP,
metadata={"user_id": user.id}
)
# Available signals: THUMBS_UP, THUMBS_DOWN, EDIT, COPY, SAVE,
# EXECUTE, REGENERATE, FLAG, ACCEPT, REJECT, and more
Custom Signal Mappings
For domain-specific signal interpretation, provide a custom mapping at initialization:
from ateam_llm_tracer import SignalType, init_tracing
# Define your domain-specific signal interpretation
custom_mapping = {
SignalType.EXECUTE: ("executed", 1.0), # High quality
SignalType.EDIT: ("edited", 0.6), # Partial quality
SignalType.REGENERATE: ("regen", 0.2), # Low quality
# Map only the signals you care about
}
init_tracing(
project_name="my-project",
service_name="my-service",
phoenix_endpoint="https://phoenix.internal.a.team",
signal_mapping=custom_mapping # Pass your custom mapping
)
See examples/custom_signal_handler.py for complete examples.
Requirements
- Python 3.11+
- Phoenix instance for trace collection
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ateam_llm_tracer-0.1.0.tar.gz.
File metadata
- Download URL: ateam_llm_tracer-0.1.0.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
860e4c1ae61b1e5daf17f76ddfebab0fcc0c76ae01f128fd7dd9411b4d9ace65
|
|
| MD5 |
a8de08e72b93e95b91591ecc42e3a7d6
|
|
| BLAKE2b-256 |
be50c67068cbf0a6cbd37288666526d6135805ae99720e54676a5346d7cfaba4
|
File details
Details for the file ateam_llm_tracer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ateam_llm_tracer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33565d05dd2ccfe76f4317b72f6947c5d77e43a34ad756488fda68564ebba782
|
|
| MD5 |
91b8655c20cd8e5b1e248d09e67874f2
|
|
| BLAKE2b-256 |
c70457e9d88e04a28caf1644ac8e15344238869b72b5e8fe42936f2b451cbb32
|