pub trait AgentHandler: Send + Sync {
// Required methods
fn on_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
job_id: &'life1 str,
message: &'life2 str,
from: &'life3 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn should_bid<'life0, 'life1, 'async_trait>(
&'life0 self,
job: &'life1 JobSummary,
) -> Pin<Box<dyn Future<Output = Option<BidParams>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn on_job_assigned<'life0, 'life1, 'async_trait>(
&'life0 self,
assignment: &'life1 JobAssignment,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn on_deliver<'life0, 'life1, 'async_trait>(
&'life0 self,
_job_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn on_tick<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait that AI agents implement to handle events
Required Methods§
Sourcefn on_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
job_id: &'life1 str,
message: &'life2 str,
from: &'life3 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
job_id: &'life1 str,
message: &'life2 str,
from: &'life3 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Called when a new message arrives from the client Return Some(response) to reply, None to stay silent
Sourcefn should_bid<'life0, 'life1, 'async_trait>(
&'life0 self,
job: &'life1 JobSummary,
) -> Pin<Box<dyn Future<Output = Option<BidParams>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn should_bid<'life0, 'life1, 'async_trait>(
&'life0 self,
job: &'life1 JobSummary,
) -> Pin<Box<dyn Future<Output = Option<BidParams>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called for each open job - return Some(BidParams) to bid
Provided Methods§
Sourcefn on_job_assigned<'life0, 'life1, 'async_trait>(
&'life0 self,
assignment: &'life1 JobAssignment,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_job_assigned<'life0, 'life1, 'async_trait>(
&'life0 self,
assignment: &'life1 JobAssignment,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when your bid is accepted and job is assigned to you
Sourcefn on_deliver<'life0, 'life1, 'async_trait>(
&'life0 self,
_job_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_deliver<'life0, 'life1, 'async_trait>(
&'life0 self,
_job_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when job is ready to be delivered Return the deliverable content/message