Skip to main content

A2ARequest

Struct A2ARequest 

Source
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: String

JSON-RPC version.

§id: u64

Request identifier.

§method: String

Method 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 for tasks/send (P1-6).

Implementations§

Source§

impl A2ARequest

Source

pub fn new(id: u64, method: impl Into<String>, params: Option<Value>) -> Self

Create a new request.

Source

pub fn send_task(id: u64, message: &A2AMessage) -> Self

Create a tasks/send request.

Source

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.

Source

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.

Source

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.

Source

pub fn get_task(id: u64, task_id: &str) -> Self

Create a tasks/get request.

Source

pub fn cancel_task(id: u64, task_id: &str) -> Self

Create a tasks/cancel request.

Source

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.

Source

pub fn with_metadata(self, metadata: Value) -> Self

Set the request metadata payload (P1-5).

Source

pub fn with_trace_id(self, trace_id: impl Into<String>) -> Self

Set the W3C-style trace id in metadata (P1-5 / P2-8).

Source

pub fn with_owner(self, owner: impl Into<String>) -> Self

Set the caller/owner identity in metadata (P1-4).

Source

pub fn with_message_id(self, message_id: impl Into<String>) -> Self

Set the idempotency key for tasks/send (P1-6).

Source

pub fn trace_id(&self) -> Option<&str>

W3C-style trace id carried in metadata (P1-5).

Source

pub fn owner(&self) -> Option<&str>

Caller/owner identity carried in metadata (P1-4).

Source

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).

Source

pub fn task_id(&self) -> Option<&str>

The taskId param for continuation requests (P2-2/P2-3).

Trait Implementations§

Source§

impl Clone for A2ARequest

Source§

fn clone(&self) -> A2ARequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for A2ARequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for A2ARequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for A2ARequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more