Skip to main content

agent_sdk/agent/
handle.rs

1use crate::error::AgentId;
2use tokio::task::JoinHandle;
3
4#[derive(Debug)]
5pub struct AgentResult {
6    pub agent_id: AgentId,
7    pub name: String,
8    pub tasks_completed: usize,
9    pub tasks_failed: usize,
10    pub total_tokens_used: u64,
11}
12
13pub struct AgentHandle {
14    pub agent_id: AgentId,
15    pub name: String,
16    pub handle: JoinHandle<AgentResult>,
17}
18
19impl AgentHandle {
20    pub fn new(agent_id: AgentId, name: String, handle: JoinHandle<AgentResult>) -> Self {
21        Self {
22            agent_id,
23            name,
24            handle,
25        }
26    }
27
28    pub fn is_finished(&self) -> bool {
29        self.handle.is_finished()
30    }
31}