Skip to main content

A2aNode

Struct A2aNode 

Source
pub struct A2aNode { /* private fields */ }
Expand description

A node’s delegation to a remote A2A agent, behind the same Node trait as a local node.

Error semantics across the wire. A task the remote agent settles failed flattens to RustyError::Node — a hard, non-retryable failure, the RemoteNode rule: the callee already made a definitive decision, and retry classification does not survive a process boundary. This client’s own retries cover transport-class failures only (connect errors, timeouts, HTTP 5xx / 408 / 429 — see the module docs). A task found canceled on poll (someone else cancelled it) is likewise definitive.

use std::time::Duration;
use rusty_agent_runtime::a2a::A2aNode;
use rusty_agent_runtime::graph::GraphBuilder;

let node = A2aNode::new("researcher", "http://127.0.0.1:8300")
    .with_timeout(Duration::from_secs(10))
    .with_poll_interval(Duration::from_millis(250));
let mut builder = GraphBuilder::new();
builder.add_node("research", node);

Implementations§

Source§

impl A2aNode

Source

pub fn new(name: impl Into<String>, base_url: impl Into<String>) -> Self

A node delegating to the remote agent served at base_url (e.g. "http://127.0.0.1:8300"). A trailing / is trimmed and /a2a appended; a base_url already ending in /a2a is used verbatim. The terminal outcome is written to the a2a_outcome channel unless A2aNode::with_channel says otherwise.

Source

pub fn with_timeout(self, timeout: Duration) -> Self

Override the per-request timeout.

Source

pub fn with_retries(self, max_retries: u32) -> Self

Override the number of retries after the initial attempt (0 = single attempt).

Source

pub fn with_backoff(self, base_backoff: Duration) -> Self

Override the base backoff delay between retries.

Source

pub fn with_poll_interval(self, poll_interval: Duration) -> Self

Override the tasks/get poll interval.

Source

pub fn with_channel(self, channel: impl Into<String>) -> Self

Override the state channel the terminal outcome is written to.

Source

pub fn with_api_key(self, key: impl Into<String>) -> Self

Present key as the X-Api-Key header on every request (rusty-agent-server’s tenant authentication; other agents ignore or map it per their own auth model).

Source

pub fn with_journal(self, journal: Journal) -> Self

Attach the run’s journal: the delegation is recorded as one RemoteCall event, parented on the invoking node-input event delivered via PARENT_EVENT_KEY. Without a journal the node still works — it just leaves no evidence, the same posture as an unwrapped crate::remote::RemoteNode.

Source

pub fn with_cancellation(self, token: CancellationToken) -> Self

Attach the run’s cancellation token: when it fires mid-delegation the node sends tasks/cancel for the in-flight remote task (best effort — the cancel itself is not retried), journals the canceled outcome, and returns RustyError::Cancelled.

Source

pub fn replaying(self, source: ReplaySource, journal: Journal) -> Self

The replaying half (R0.9 wave 4): serve the delegation’s outcome from the recorded run’s ReplaySource instead of the network. No HTTP client is kept — a replayed run cannot reach the remote agent by construction, the JournaledMcpTool::replaying discipline. The replay run’s journal is still required: the served event is re-journaled into it.

Source

pub fn message_id(&self, thread_id: &str, step: usize) -> String

The derived messageId for one invocation: the delegation’s idempotency handle (see the module docs).

Source

pub fn rpc_url(&self) -> &str

The full JSON-RPC endpoint URL.

Trait Implementations§

Source§

impl Clone for A2aNode

Source§

fn clone(&self) -> Self

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 Node for A2aNode

Source§

fn name(&self) -> &str

Human/log-friendly name. Closure nodes default to "anonymous"; the graph tracks nodes by the name given to add_node, which is the authoritative identity.
Source§

fn effect(&self) -> Effect

The declared default effect classification of this node (Flight Recorder, R0.5): recorded on the node’s journal events and used by retry/replay policy. Read more
Source§

fn run<'life0, 'async_trait>( &'life0 self, ctx: NodeContext, ) -> Pin<Box<dyn Future<Output = Result<NodeOutput>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the node against a super-step state snapshot.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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