pub struct AgentSession {
pub session_id: String,
pub executor_type: ExecutorType,
pub working_dir: PathBuf,
pub created_at: DateTime<Utc>,
pub model: Option<String>,
/* private fields */
}Expand description
Active agent session.
Returned by AgentExecutor::spawn() or resume().
Use query() for follow-up prompts, total_cost() for spend tracking,
and close() to clean up.
Fields§
§session_id: StringUnique session identifier.
executor_type: ExecutorTypeWhich executor created this session.
working_dir: PathBufWorking directory.
created_at: DateTime<Utc>Creation timestamp.
model: Option<String>Model being used.
Implementations§
Source§impl AgentSession
impl AgentSession
Sourcepub fn new(
session_id: impl Into<String>,
executor_type: ExecutorType,
working_dir: impl Into<PathBuf>,
model: Option<String>,
inner: Arc<dyn SessionImpl>,
) -> Self
pub fn new( session_id: impl Into<String>, executor_type: ExecutorType, working_dir: impl Into<PathBuf>, model: Option<String>, inner: Arc<dyn SessionImpl>, ) -> Self
Create a new session with an inner implementation.
Sourcepub async fn query(&self, prompt: &str) -> Result<AgentResponse>
pub async fn query(&self, prompt: &str) -> Result<AgentResponse>
Send a follow-up prompt to the agent.
Sourcepub async fn total_cost(&self) -> Result<AgentCost>
pub async fn total_cost(&self) -> Result<AgentCost>
Get the accumulated cost of this session.
Sourcepub fn metadata(&self) -> SessionMetadata
pub fn metadata(&self) -> SessionMetadata
Session metadata snapshot.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentSession
impl !RefUnwindSafe for AgentSession
impl Send for AgentSession
impl Sync for AgentSession
impl Unpin for AgentSession
impl UnsafeUnpin for AgentSession
impl !UnwindSafe for AgentSession
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