pub struct A2AServer { /* private fields */ }Expand description
handle_a2a_request() and get_agent_card() that you can call from
any HTTP framework’s route handler.
Tasks are stored in-memory so that tasks/get can retrieve them and
tasks/cancel can transition their status. When the task store exceeds
max_tasks, the oldest completed/failed/cancelled tasks are evicted first.
Implementations§
Source§impl A2AServer
impl A2AServer
Sourcepub fn with_max_tasks(self, max: usize) -> Self
pub fn with_max_tasks(self, max: usize) -> Self
Set the maximum number of tasks before LRU eviction.
Sourcepub fn get_agent_card(&self) -> &AgentCard
pub fn get_agent_card(&self) -> &AgentCard
Get the agent card (for GET /.well-known/agent.json).
Sourcepub async fn handle_a2a_request(&self, req: A2ARequest) -> A2AResponse
pub async fn handle_a2a_request(&self, req: A2ARequest) -> A2AResponse
Handle an incoming A2A request (for POST /).
Dispatches based on the request method:
tasks/send-> invoke the chain and return a task resulttasks/get-> return a stored tasktasks/cancel-> cancel a stored task- unknown method -> method_not_found error
Auto Trait Implementations§
impl !Freeze for A2AServer
impl !RefUnwindSafe for A2AServer
impl !UnwindSafe for A2AServer
impl Send for A2AServer
impl Sync for A2AServer
impl Unpin for A2AServer
impl UnsafeUnpin for A2AServer
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