pub struct A2AApi { /* private fields */ }Expand description
Agent-to-Agent protocol: discovery and task execution
Implementations§
Source§impl A2AApi
impl A2AApi
Sourcepub async fn a2a_json_rpc(&self, body: &A2ajsonRpcRequest) -> Result<Value>
pub async fn a2a_json_rpc(&self, body: &A2ajsonRpcRequest) -> Result<Value>
A2A JSON-RPC 2.0 endpoint
Handles tasks/send, tasks/sendSubscribe, tasks/get, tasks/cancel,
tasks/pushNotification/set, tasks/pushNotification/get via JSON-RPC 2.0.
Scope dispatch is dynamic per JSON-RPC method: read-style methods (tasks/get,
tasks/pushNotification/get) require agents:read; write-style (tasks/send,
tasks/sendSubscribe, tasks/cancel, tasks/pushNotification/set) require agents:write.
The static bearerAuth: \[agents:write\] declared here is the strictest scope; an
agents:read-only key works for the read methods but the spec cannot express the per-method
conditional.
POST /api/v1/a2a
Required scopes: agents:write.
Sourcepub async fn cancel_a2a_task(
&self,
task_id: &str,
) -> Result<CancelA2ATaskResponse>
pub async fn cancel_a2a_task( &self, task_id: &str, ) -> Result<CancelA2ATaskResponse>
Cancel an A2A task
POST /api/v1/a2a/tasks/{taskId}/cancel
Required scopes: agents:write.
Sourcepub async fn create_a2a_task(
&self,
body: &CreateA2ATaskRequest,
) -> Result<A2ATask>
pub async fn create_a2a_task( &self, body: &CreateA2ATaskRequest, ) -> Result<A2ATask>
Create an A2A task
Creates a new agent-to-agent task and schedules the underlying run.
POST /api/v1/a2a/tasks
Required scopes: agents:write.
Sourcepub async fn get_a2a_task(&self, task_id: &str) -> Result<A2ATask>
pub async fn get_a2a_task(&self, task_id: &str) -> Result<A2ATask>
Get A2A task status
GET /api/v1/a2a/tasks/{taskId}
Required scopes: agents:read.
Sourcepub async fn get_agent_card(&self, params: &GetAgentCardParams) -> Result<Value>
pub async fn get_agent_card(&self, params: &GetAgentCardParams) -> Result<Value>
Get A2A agent card for discovery
GET /.well-known/agent.json
Sourcepub async fn list_a2a_tasks(
&self,
params: &ListA2ATasksParams,
) -> Result<ListA2ATasksResponse>
pub async fn list_a2a_tasks( &self, params: &ListA2ATasksParams, ) -> Result<ListA2ATasksResponse>
List A2A tasks
GET /api/v1/a2a/tasks
Required scopes: agents:read.
Sourcepub fn list_a2a_tasks_all<'a>(
&'a self,
params: &'a ListA2ATasksParams,
) -> impl Stream<Item = Result<A2ATask>> + 'a
pub fn list_a2a_tasks_all<'a>( &'a self, params: &'a ListA2ATasksParams, ) -> impl Stream<Item = Result<A2ATask>> + 'a
Stream every item returned by listA2ATasks, following the cursor cursor until the server
reports no further pages.
Sourcepub fn stream_a2a_task_events(&self, task_id: &str) -> EventStream
pub fn stream_a2a_task_events(&self, task_id: &str) -> EventStream
Stream A2A task status updates (SSE)
GET /api/v1/a2a/tasks/{taskId}/events
Required scopes: agents:read.
Returns a server-sent event stream.