High-performance LLM tracing SDK with OpenTelemetry compliance and real-time evaluation
Project description
Noveum Trace SDK
Production-ready Python SDK for tracing LLM applications, multi-agent systems, and tool calls with OpenTelemetry compliance.
๐ Quick Start
import noveum_trace
# Initialize with your project ID
noveum_trace.init(project_id="my-ai-project")
# Use the simple @trace decorator
@noveum_trace.trace
def process_data(data):
return f"Processed: {data}"
@noveum_trace.trace(type="llm", model="gpt-4")
def call_llm(prompt):
# Your LLM call here
return "AI response"
@noveum_trace.trace(type="component", agent="data-processor")
def agent_task(task):
return f"Agent completed: {task}"
# Your functions are now automatically traced!
result = process_data("user input")
โจ Key Features
๐ฏ Simplified Decorator Approach
- Single
@tracedecorator with parameters instead of multiple decorators - Backward compatibility with
@observeand@llm_tracealiases - Parameter-based specialization for different operation types
๐ค Multi-Agent Support
- Agent registry and management with hierarchical relationships
- Cross-agent correlation and trace propagation
- Agent-aware context management for complex workflows
- Thread-safe operations for concurrent agent execution
๐ LLM & Tool Call Tracing
- Auto-instrumentation for OpenAI and Anthropic SDKs
- Comprehensive LLM metrics (tokens, latency, model info)
- Tool call tracking with arguments and results
- OpenTelemetry semantic conventions compliance
๐๏ธ Project-Based Organization
- Required project ID for proper trace organization
- Custom headers support (projectId, orgId, additional headers)
- Environment-aware (development, staging, production)
- Proper trace ID generation with UUID-based identifiers
๐ฆ Installation
pip install noveum-trace
๐ง Configuration
Basic Initialization
import noveum_trace
# Minimal setup (project_id is required)
tracer = noveum_trace.init(project_id="my-project")
# Full configuration
tracer = noveum_trace.init(
project_id="my-project",
project_name="My AI Application",
org_id="org-123",
user_id="user-456",
session_id="session-789",
environment="production",
api_key="your-noveum-api-key", # For Noveum.ai platform
file_logging=True,
log_directory="./traces",
auto_instrument=True,
capture_content=True,
custom_headers={"X-Custom-Header": "value"}
)
Environment Variables
export NOVEUM_PROJECT_ID="my-project"
export NOVEUM_API_KEY="your-api-key"
export NOVEUM_ORG_ID="org-123"
export NOVEUM_USER_ID="user-456"
export NOVEUM_SESSION_ID="session-789"
export NOVEUM_ENVIRONMENT="production"
๐จ Usage Examples
Simple Function Tracing
@noveum_trace.trace
def data_processing(data):
# Your processing logic
return processed_data
@noveum_trace.trace(name="custom-operation")
def custom_function():
return "result"
LLM Tracing
@noveum_trace.trace(type="llm", model="gpt-4", operation="chat")
def chat_completion(messages):
response = openai.chat.completions.create(
model="gpt-4",
messages=messages
)
return response
@noveum_trace.trace(type="llm", model="claude-3", operation="completion")
def text_completion(prompt):
response = anthropic.messages.create(
model="claude-3-haiku-20240307",
messages=[{"role": "user", "content": prompt}]
)
return response
Multi-Agent Workflows
from noveum_trace import Agent, AgentConfig, AgentContext, trace
# Define agents
coordinator = Agent(AgentConfig(
name="coordinator",
agent_type="orchestrator",
id="coord-001"
))
worker = Agent(AgentConfig(
name="data-worker",
agent_type="processor",
id="worker-001"
))
# Use agent context
with AgentContext(coordinator):
@trace
def plan_task(task):
# Coordinator planning
return task_plan
plan = plan_task("analyze data")
with AgentContext(worker):
@trace
def execute_task(plan):
# Worker execution
return results
results = execute_task(plan)
Tool Call Tracing
@noveum_trace.trace(type="tool", tool_name="web_search")
def search_web(query):
# Tool implementation
return search_results
@noveum_trace.trace(type="tool", tool_name="calculator")
def calculate(expression):
# Calculator implementation
return result
Dynamic Span Updates
from noveum_trace import trace, update_current_span
@trace
def long_running_task():
update_current_span(
metadata={"step": "initialization"},
progress=10
)
# Do some work
initialize()
update_current_span(
metadata={"step": "processing"},
progress=50
)
# More work
process_data()
update_current_span(
metadata={"step": "completion"},
progress=100
)
return "completed"
๐ Auto-Instrumentation
The SDK automatically instruments popular LLM libraries:
# Auto-instrumentation is enabled by default
noveum_trace.init(project_id="my-project", auto_instrument=True)
# Now all OpenAI and Anthropic calls are automatically traced
import openai
response = openai.chat.completions.create(...) # Automatically traced!
import anthropic
response = anthropic.messages.create(...) # Automatically traced!
๐ Trace Data Structure
Each trace contains:
{
"trace_id": "uuid-v4",
"span_id": "uuid-v4",
"parent_span_id": "uuid-v4",
"name": "operation-name",
"kind": "internal|client|server",
"status": "ok|error",
"start_time": "2024-01-01T00:00:00Z",
"end_time": "2024-01-01T00:00:01Z",
"duration_ms": 1000,
"project_id": "my-project",
"project_name": "My AI Application",
"org_id": "org-123",
"user_id": "user-456",
"session_id": "session-789",
"environment": "production",
"attributes": {
"llm.model": "gpt-4",
"llm.operation": "chat",
"gen_ai.system": "openai",
"gen_ai.usage.input_tokens": 100,
"gen_ai.usage.output_tokens": 50
},
"llm_request": {
"model": "gpt-4",
"messages": [...],
"temperature": 0.7
},
"llm_response": {
"id": "response-id",
"model": "gpt-4",
"choices": [...],
"usage": {
"prompt_tokens": 100,
"completion_tokens": 50,
"total_tokens": 150
}
},
"agent": {
"name": "data-processor",
"type": "worker",
"id": "agent-123"
},
"tool_calls": [
{
"id": "call-123",
"name": "web_search",
"arguments": {"query": "AI news"},
"result": "search results",
"duration_ms": 500
}
]
}
๐ Competitive Advantages
| Feature | Noveum Trace | DeepEval | Phoenix | Braintrust |
|---|---|---|---|---|
| Multi-agent support | โ | โ | โ ๏ธ | โ ๏ธ |
| Simplified decorators | โ | โ | โ | โ |
| Auto agent resolution | โ | โ | โ | โ |
| OpenTelemetry compliant | โ | โ | โ | โ |
| Project-based organization | โ | โ | โ | โ |
| Custom headers | โ | โ | โ | โ |
| Trace ID management | โ | โ ๏ธ | โ | โ ๏ธ |
| Tool call tracing | โ | โ | โ ๏ธ | โ ๏ธ |
๐ Project Structure
noveum-trace/
โโโ src/noveum_trace/
โ โโโ __init__.py # Main exports
โ โโโ init.py # Simplified initialization
โ โโโ types.py # Type definitions
โ โโโ core/
โ โ โโโ tracer.py # Main tracer implementation
โ โ โโโ span.py # Span implementation
โ โ โโโ context.py # Context management
โ โโโ agents/
โ โ โโโ agent.py # Agent classes
โ โ โโโ registry.py # Agent registry
โ โ โโโ context.py # Agent context
โ โ โโโ decorators.py # Simplified decorators
โ โโโ sinks/
โ โ โโโ base.py # Base sink interface
โ โ โโโ file.py # File sink
โ โ โโโ console.py # Console sink
โ โ โโโ noveum.py # Noveum.ai sink
โ โ โโโ elasticsearch.py # Elasticsearch sink
โ โโโ instrumentation/
โ โ โโโ openai.py # OpenAI auto-instrumentation
โ โ โโโ anthropic.py # Anthropic auto-instrumentation
โ โโโ utils/
โ โโโ exceptions.py # Custom exceptions
โโโ examples/ # Usage examples
โโโ tests/ # Test suite
โโโ docs/ # Documentation
โโโ README.md # This file
๐งช Testing
# Run all tests
python -m pytest tests/
# Run specific test categories
python -m pytest tests/unit/
python -m pytest tests/integration/
# Run with coverage
python -m pytest tests/ --cov=noveum_trace
๐ Documentation
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
๐ Support
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
๐ Roadmap
- JavaScript/TypeScript SDK - Cross-platform support
- Real-time evaluation - Integration with NovaEval
- Advanced analytics - Performance insights and recommendations
- Custom metrics - User-defined metrics and alerts
- Distributed tracing - Cross-service trace correlation
- Visual trace explorer - Interactive trace visualization
Built with โค๏ธ by the Noveum team
Project details
Release history Release notifications | RSS feed
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 noveum_trace-0.1.1.tar.gz.
File metadata
- Download URL: noveum_trace-0.1.1.tar.gz
- Upload date:
- Size: 61.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcc1a64918a7f47cbaf4f4306869224682a41d67e758bb91c8796222cda03ac7
|
|
| MD5 |
a3f8730fe0c759994157c34575a0b2b4
|
|
| BLAKE2b-256 |
1b3c6903218bdeb584efa4f9c7ea61791674be9c56f22d39b60c79e0a45a5e36
|
File details
Details for the file noveum_trace-0.1.1-py3-none-any.whl.
File metadata
- Download URL: noveum_trace-0.1.1-py3-none-any.whl
- Upload date:
- Size: 68.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cb0dd6039cea6cd6490d3dcefa62fa4f6ce102842cd22f1ac24c32e5babf809
|
|
| MD5 |
58c1d3936cb9e5a802a1e8017b09b3c6
|
|
| BLAKE2b-256 |
8101a171f6ab5ee6c029a4237eb2980ccaf50ce67963bd68e5a0cf48c0f6a241
|