pub struct Session {
pub key: SessionKey,
pub agent_id: String,
pub kind: SessionKind,
pub status: SessionStatus,
pub label: Option<String>,
pub task: Option<String>,
pub created_ms: u64,
pub finished_ms: Option<u64>,
pub messages: Vec<SessionMessage>,
pub run_id: Option<String>,
pub parent_key: Option<SessionKey>,
}Expand description
A session record.
Fields§
§key: SessionKey§agent_id: String§kind: SessionKind§status: SessionStatus§label: Option<String>§task: Option<String>§created_ms: u64§finished_ms: Option<u64>§messages: Vec<SessionMessage>Recent messages (limited for memory efficiency).
run_id: Option<String>Run ID for sub-agents.
parent_key: Option<SessionKey>Parent session key (for sub-agents).
Implementations§
Source§impl Session
impl Session
Sourcepub fn new_subagent(
agent_id: &str,
task: &str,
label: Option<String>,
parent_key: Option<SessionKey>,
) -> Self
pub fn new_subagent( agent_id: &str, task: &str, label: Option<String>, parent_key: Option<SessionKey>, ) -> Self
Create a new sub-agent session.
Sourcepub fn add_message(&mut self, role: &str, content: &str)
pub fn add_message(&mut self, role: &str, content: &str)
Add a message to the session.
Sourcepub fn runtime_secs(&self) -> u64
pub fn runtime_secs(&self) -> u64
Get runtime in seconds.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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