Multi-Agent Teams
Run multiple agents that coordinate via A2A protocol.
Architecture
price-oracle (port 9001) ──── provides market data
risk-engine (port 9002) ──── computes risk scores
alpha-trader (port 9003) ──── orchestrates decisionsEach agent has its own wallet, memory, LLM planner, and A2A server.
Launch a Team
# Terminal 1 — Price Oracle
forge run ./price-oracle --mode paper --a2a-port 9001
# Terminal 2 — Risk Engine
forge run ./risk-engine --mode paper --a2a-port 9002
# Terminal 3 — Alpha Trader (orchestrator)
forge run ./alpha-trader --mode paper --a2a-port 9003Or use a launch script:
import subprocess
agents = [
("./price-oracle", 9001),
("./risk-engine", 9002),
("./alpha-trader", 9003),
]
procs = []
for path, port in agents:
p = subprocess.Popen([
"forge", "run", path,
"--mode", "paper",
"--auto-approve",
"--a2a-port", str(port),
])
procs.append(p)
for p in procs:
p.wait()Agent Communication
The alpha-trader queries peers via A2A:
# Get price from oracle
forge agent-send http://localhost:9001 \
--capability get-token-price \
--payload '{"token":"ETH"}'
# Get risk score
forge agent-send http://localhost:9002 \
--capability risk-score \
--payload '{"token":"ETH","side":"buy"}'Each message is EIP-712 signed — the receiver verifies the sender’s wallet address.
Paid Inter-Agent Queries
Agents can charge for premium capabilities using x402:
alpha-trader → price-oracle: GET /x402/premium-analysis
→ 402: $0.005 USDC required
→ Signs EIP-3009, pays on Base
→ 200: premium data deliveredSee Accept Payments for setup details.
Discovery
Agents discover each other through:
- Direct URL —
http://localhost:9001 - Local registry —
forge agent-list - On-chain registry —
forge agent-discover --capability get-token-price
Last updated on