pub struct A2ARequest {
pub jsonrpc: String,
pub id: u64,
pub method: String,
pub params: Option<Value>,
pub metadata: Option<Value>,
}Expand description
A2A JSON-RPC style request.
Fields§
§jsonrpc: StringJSON-RPC version.
id: u64Request identifier.
method: StringMethod name (e.g. “tasks/send”, “tasks/get”).
params: Option<Value>Method parameters.
metadata: Option<Value>Optional metadata (P1-5 / P2-8).
Carries the W3C trace_id, the caller/owner identity, and other
cross-cutting data without polluting the method-specific params.
Standard well-known keys (read via the accessor helpers):
trace_id— W3C-style trace id for distributed tracing (P1-5);owner— caller identity used for task ownership authorization (P1-4);message_id— idempotency key fortasks/send(P1-6).
Implementations§
Source§impl A2ARequest
impl A2ARequest
Sourcepub fn new(id: u64, method: impl Into<String>, params: Option<Value>) -> Self
pub fn new(id: u64, method: impl Into<String>, params: Option<Value>) -> Self
Create a new request.
Sourcepub fn send_task(id: u64, message: &A2AMessage) -> Self
pub fn send_task(id: u64, message: &A2AMessage) -> Self
Create a tasks/send request.
Sourcepub fn send_task_with_message_id(
id: u64,
message: &A2AMessage,
message_id: &str,
) -> Self
pub fn send_task_with_message_id( id: u64, message: &A2AMessage, message_id: &str, ) -> Self
Create a tasks/send request with an idempotency key (P1-6).
Re-sending the same message_id makes the server return the already
created task instead of running the chain twice.
Sourcepub fn send_envelope(id: u64, envelope: &MessageEnvelope) -> Self
pub fn send_envelope(id: u64, envelope: &MessageEnvelope) -> Self
Create a tasks/send request from a MessageEnvelope, propagating
its owner and trace context into request metadata (P2-8).
Lets a transport-neutral envelope be handed to the JSON-RPC HTTP layer without losing the cross-cutting metadata it carries.
Sourcepub fn continue_task(id: u64, task_id: &str, message: &A2AMessage) -> Self
pub fn continue_task(id: u64, task_id: &str, message: &A2AMessage) -> Self
Create a tasks/send request that continues an existing task (P2-2/P2-3).
Used to resume an input-required task or append a new turn to a
multi-turn conversation: the server appends message to the task’s
history and (re)starts processing.
Sourcepub fn cancel_task(id: u64, task_id: &str) -> Self
pub fn cancel_task(id: u64, task_id: &str) -> Self
Create a tasks/cancel request.
Sourcepub fn run_workflow(id: u64, workflow: &A2AWorkflow) -> Self
pub fn run_workflow(id: u64, workflow: &A2AWorkflow) -> Self
Create a tasks/runWorkflow request (P2-8).
The server executes the workflow’s steps in order and returns the per-step results in the response.
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Set the request metadata payload (P1-5).
Sourcepub fn with_trace_id(self, trace_id: impl Into<String>) -> Self
pub fn with_trace_id(self, trace_id: impl Into<String>) -> Self
Set the W3C-style trace id in metadata (P1-5 / P2-8).
Sourcepub fn with_owner(self, owner: impl Into<String>) -> Self
pub fn with_owner(self, owner: impl Into<String>) -> Self
Set the caller/owner identity in metadata (P1-4).
Sourcepub fn with_message_id(self, message_id: impl Into<String>) -> Self
pub fn with_message_id(self, message_id: impl Into<String>) -> Self
Set the idempotency key for tasks/send (P1-6).
Sourcepub fn message_id(&self) -> Option<&str>
pub fn message_id(&self) -> Option<&str>
Idempotency key for tasks/send (P1-6).
Checks the metadata message_id first, then falls back to a
top-level params.messageId (the A2A wire convention).
Trait Implementations§
Source§impl Clone for A2ARequest
impl Clone for A2ARequest
Source§fn clone(&self) -> A2ARequest
fn clone(&self) -> A2ARequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more