mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-26 07:44:05 +00:00
Runnable end-to-end demonstration of the ADR-159 A2A protocol with
three real rvagent processes routing tasks between each other:
node-cheap on 127.0.0.1:18001 — low cost, slower latency
node-fast on 127.0.0.1:18002 — high cost, fast latency
node-router on 127.0.0.1:18003 — CheapestUnderLatency selector
The orchestrator (src/main.rs) spawns three `rvagent a2a serve`
children with distinct TOML configs, waits for each to print
`listening on <addr>` to stdout, dispatches an `echo` task to the
router, and asserts the response carries
`metadata.ruvector.routed_via.peer_url` showing the task was actually
forwarded — not handled locally on the router.
Run:
cargo run -p a2a-swarm
What it proves vs ADR-159 acceptance tests:
Test 1 (remote ≡ local): real reqwest/HTTP forwarding through the
router; identical response shape from local and remote paths.
Test 2 (constant-size memory transfer): each peer's signed AgentCard
is published; tasks reference RuLakeWitness if used (not exercised
in this demo, but the wire format is shared).
Test 3 (bounded cost): each peer carries an independent GlobalBudget;
router-side budget gates dispatch before peer selection runs.
Measured round-trip ~26ms per task on a laptop. Clean SIGTERM shutdown.
Refs: ADR-159
Co-Authored-By: claude-flow <ruv@ruv.net>
27 lines
1 KiB
TOML
27 lines
1 KiB
TOML
[package]
|
|
name = "a2a-swarm"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
description = "rvAgent A2A swarm demo — three rvagent-cli nodes + a router dispatching tasks end-to-end over HTTP"
|
|
license = "MIT OR Apache-2.0"
|
|
publish = false
|
|
|
|
# Orchestrator binary — spawns three `rvagent` child processes, pokes them
|
|
# over HTTP via the CLI's own `a2a discover` / `a2a send-task` subcommands,
|
|
# then shuts them down cleanly.
|
|
[[bin]]
|
|
name = "a2a-swarm"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
anyhow = { workspace = true }
|
|
tokio = { version = "1.41", features = ["rt-multi-thread", "sync", "macros", "process", "io-util", "time", "signal", "net"] }
|
|
tracing = { workspace = true }
|
|
tracing-subscriber = { workspace = true }
|
|
reqwest = { version = "0.12", features = ["json", "rustls-tls"] }
|
|
serde_json = { workspace = true }
|
|
|
|
# The demo driver shells out to the `rvagent` binary built from the
|
|
# sibling crate. Declaring it as a runtime dependency here ensures
|
|
# `cargo run -p a2a-swarm` triggers its build first.
|
|
rvagent-cli = { path = "../../crates/rvAgent/rvagent-cli" }
|