What Are Sessions?
A session represents a logical grouping of traces. Common examples:- A conversation with a user
- A batch processing job
- A multi-step workflow
- A user’s session on your application
Creating Sessions
There are two ways to create sessions: via thetrace() function (recommended for explicit tracing) or via telemetry metadata on individual prompt calls.
Using trace() with Session Options
The trace() function accepts sessionId and sessionName as first-class options:
- TypeScript
- Python
Using Telemetry Metadata
For cases where you don’t need explicit tracing, pass session info through telemetry metadata:- TypeScript
- Python
Session Patterns
Conversational Sessions
Track multi-turn conversations usingtrace() for full control:
- TypeScript
- Python
Workflow Sessions
Track multi-step workflows with child spans:Batch Processing Sessions
Track batch jobs where each item generates its own trace:Session Lifecycle
Start: Create session ID when workflow beginsBest Practices
Use consistent session IDs:Viewing Sessions
Sessions are viewable in the AgentMark platform dashboard where you can:- See all traces grouped by session
- Analyze session duration and performance
- Filter traces within a session
- Compare sessions
- Debug multi-step workflows
Next Steps
Traces and Logs
Learn about trace collection
AgentMark Platform
View sessions in the dashboard