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
impl A2aNode
Sourcepub fn new(name: impl Into<String>, base_url: impl Into<String>) -> Self
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.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Override the per-request timeout.
Sourcepub fn with_retries(self, max_retries: u32) -> Self
pub fn with_retries(self, max_retries: u32) -> Self
Override the number of retries after the initial attempt (0 =
single attempt).
Sourcepub fn with_backoff(self, base_backoff: Duration) -> Self
pub fn with_backoff(self, base_backoff: Duration) -> Self
Override the base backoff delay between retries.
Sourcepub fn with_poll_interval(self, poll_interval: Duration) -> Self
pub fn with_poll_interval(self, poll_interval: Duration) -> Self
Override the tasks/get poll interval.
Sourcepub fn with_channel(self, channel: impl Into<String>) -> Self
pub fn with_channel(self, channel: impl Into<String>) -> Self
Override the state channel the terminal outcome is written to.
Sourcepub fn with_api_key(self, key: impl Into<String>) -> Self
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).
Sourcepub fn with_journal(self, journal: Journal) -> Self
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.
Sourcepub fn with_cancellation(self, token: CancellationToken) -> Self
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.
Sourcepub fn replaying(self, source: ReplaySource, journal: Journal) -> Self
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.
Sourcepub fn message_id(&self, thread_id: &str, step: usize) -> String
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).
Trait Implementations§
Source§impl Node for A2aNode
impl Node for A2aNode
Source§fn name(&self) -> &str
fn name(&self) -> &str
"anonymous";
the graph tracks nodes by the name given to add_node, which is the
authoritative identity.