pub struct Session {
pub id: u64,
pub agent: CompactString,
pub history: Vec<Message>,
pub created_by: CompactString,
pub created_at: Instant,
}Expand description
A conversation session tied to a specific agent.
Sessions own the conversation history and are stored behind
Arc<Mutex<Session>> in the runtime. Multiple sessions can
reference the same agent — each with independent history.
Fields§
§id: u64Unique session identifier (monotonic counter).
agent: CompactStringName of the agent this session is bound to.
history: Vec<Message>Conversation history (user/assistant/tool messages).
created_by: CompactStringOrigin of this session (e.g. “user”, “telegram:12345”, agent name).
created_at: InstantWhen this session was created.
Implementations§
Source§impl Session
impl Session
Sourcepub fn new(
id: u64,
agent: impl Into<CompactString>,
created_by: impl Into<CompactString>,
) -> Self
pub fn new( id: u64, agent: impl Into<CompactString>, created_by: impl Into<CompactString>, ) -> Self
Create a new session with an empty history.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more