SessionHandle

Struct SessionHandle 

Source
pub struct SessionHandle { /* private fields */ }
Expand description

Handle to a specific session, providing access to its data.

Implementations§

Source§

impl SessionHandle

Source

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()?;
Source

pub fn events(&self) -> Result<Vec<AgentEvent>>

Load raw events for this session.

Source

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.

Source

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.

Source

pub fn export(&self, strategy: ExportStrategy) -> Result<Vec<AgentEvent>>

Export session with specified strategy.

Source

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).

Source

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).

Source

pub fn summarize(&self) -> Result<SessionSummary>

Summarize session statistics.

Source

pub fn analyze(&self) -> Result<SessionAnalyzer>

Analyze session with diagnostic lenses.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.