Rust
This page is generated from the A2A Pack language SDK metadata.
Scaffold
a2a init math-agent --language rustImplementation Contract
Implement the A2AAgent trait and call compile_agent / serve_agent.
pub struct MathAgent;
impl A2AAgent for MathAgent {
fn definition(&self) -> AgentDefinition {
AgentDefinition { name: "math-agent", description: "Math helper", version: "0.1.0" }
}
fn sum(&self, request: SumRequest) -> Result<SumResponse, String> {
Ok(SumResponse { value: request.left + request.right })
}
}Local Commands
cargo run -- compile
cargo run -- workerSDK Package
a2a-pack-rs vendored at third_party/a2a-pack-rs.
The compiled .a2a/agent.dsl.json is the sidecar contract. The sidecar
owns public A2A, MCP, frontend, and invoke endpoints; the language SDK
owns native handler execution through the worker protocol.