pub struct SessionHandle { /* private fields */ }Expand description
Handle to a specific session, providing access to its data.
Implementations§
Source§impl SessionHandle
impl SessionHandle
Sourcepub fn from_events(events: Vec<AgentEvent>) -> Self
pub fn from_events(events: Vec<AgentEvent>) -> Self
Create a SessionHandle from raw events (for testing, simulations, custom pipelines).
This allows you to use SessionHandle API without a Client connection.
§Examples
use agtrace_sdk::{SessionHandle, types::AgentEvent};
let events: Vec<AgentEvent> = vec![/* ... */];
let handle = SessionHandle::from_events(events);
let session = handle.assemble()?;
let summary = handle.summarize()?;Sourcepub fn events(&self) -> Result<Vec<AgentEvent>>
pub fn events(&self) -> Result<Vec<AgentEvent>>
Load raw events for this session.
Sourcepub fn assemble(&self) -> Result<AgentSession>
pub fn assemble(&self) -> Result<AgentSession>
Assemble events into a structured session.
Returns only the main stream. For multi-stream sessions (with sidechains
or subagents), use assemble_all() instead.
Sourcepub fn assemble_all(&self) -> Result<Vec<AgentSession>>
pub fn assemble_all(&self) -> Result<Vec<AgentSession>>
Assemble all streams from events into separate sessions.
Unlike assemble() which returns only the main stream, this method
returns all streams (Main, Sidechain, Subagent) found in the session’s events.
Sourcepub fn export(&self, strategy: ExportStrategy) -> Result<Vec<AgentEvent>>
pub fn export(&self, strategy: ExportStrategy) -> Result<Vec<AgentEvent>>
Export session with specified strategy.
Sourcepub fn metadata(&self) -> Result<Option<SessionMetadata>>
pub fn metadata(&self) -> Result<Option<SessionMetadata>>
Get session metadata (DB-derived: project_hash, provider).
Returns None for standalone sessions (created from events without workspace).
Sourcepub fn raw_files(&self) -> Result<Vec<RawFileContent>>
pub fn raw_files(&self) -> Result<Vec<RawFileContent>>
Get raw log files for this session.
Returns the list of raw log file paths and their contents. Returns empty vector for standalone sessions (created from events without workspace).
Sourcepub fn summarize(&self) -> Result<SessionSummary>
pub fn summarize(&self) -> Result<SessionSummary>
Summarize session statistics.
Sourcepub fn analyze(&self) -> Result<SessionAnalyzer>
pub fn analyze(&self) -> Result<SessionAnalyzer>
Analyze session with diagnostic lenses.
Sourcepub fn child_sessions(&self) -> Result<Vec<ChildSessionInfo>>
pub fn child_sessions(&self) -> Result<Vec<ChildSessionInfo>>
Get child sessions (subagents) that were spawned from this session.
Returns a list of child session summaries with their spawn context (turn_index, step_index). Returns empty vector for standalone sessions.