Concurrent Traces
Managing multiple concurrent traces and sessions
Session Management in AgentOps
AgentOps supports running multiple concurrent traces (sessions) without any special mode switching or restrictions. The modern approach uses the trace-based API with start_trace()
and end_trace()
, while legacy session functions remain available for backwards compatibility.
Modern Trace-Based Approach
The recommended way to manage sessions is using the trace-based API:
Legacy Session API
For backwards compatibility, the legacy session functions are still available:
Managing Multiple Traces
Starting Traces
You can start multiple traces concurrently without any restrictions:
Ending Traces
End traces individually or all at once:
Using Decorators
The modern approach also supports decorators for automatic trace management:
LLM Call Tracking
LLM calls are automatically tracked when using the modern instrumentation. No special handling is needed for multiple concurrent traces:
Migration from Legacy Multi-Session Mode
If you’re migrating from older AgentOps versions that had multi-session mode restrictions:
- Remove multi-session mode checks - These are no longer needed
- Update to trace-based API - Use
start_trace()
andend_trace()
for new code - Simplify LLM tracking - Automatic instrumentation handles LLM calls without special session assignment
- Use decorators - Consider using
@trace
,@agent
, and@tool
decorators for cleaner code