Thank you for your interest in contributing to a2a-rust! This document provides guidelines for contributors.
Be respectful, inclusive, and constructive. We're all here to build a great A2A SDK together.
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/a2a-rust.git - Add upstream remote:
git remote add upstream https://github.com/longzhi/a2a-rust.git - Create a branch:
git checkout -b feature/your-feature-name
- Rust 1.75+ (install via rustup)
- Git
Install local git hooks after cloning:
just install-hookscargo build
cargo test
cargo test --no-default-features
cargo clippy --all-targets --all-features -- -D warnings
cargo clippy --all-targets --no-default-features -- -D warnings
cargo fmt --all
cargo check --all-features --examplesThese checks must pass before submitting a PR. CI treats all warnings as errors.
Test with different feature combinations:
cargo test --all-features # Full
cargo test --no-default-features # Types only
cargo test --no-default-features --features server # Server only
cargo test --no-default-features --features client # Client only- Check existing issues — see if someone is already working on it
- Create an issue first — for significant changes, discuss before coding
- Keep changes focused — one feature or fix per PR
- Write tests — especially serde round-trip tests for type changes
- Update documentation — rustdoc comments for all public items
This crate implements A2A Protocol v1.0 RC. When making changes:
- Check the proto definition: https://github.com/a2aproject/A2A/blob/v1.0.0-rc/specification/a2a.proto
- Check the spec: https://a2a-protocol.org/latest/specification/
- JSON field names must be
camelCase - Enum values must be
SCREAMING_SNAKE_CASE - Type structure must match proto3 definitions exactly
See AGENTS.md for detailed code conventions. Key points:
#[serde(rename_all = "camelCase")]on all typesthiserrorfor error types (this is a library crate)tracingfor logging (neverprintln!)- No
.unwrap()outside tests - Derive order:
Debug, Clone, Serialize, Deserialize
We use Conventional Commits:
<type>(<scope>): <description>
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation only |
refactor |
Code change that neither fixes a bug nor adds a feature |
test |
Adding or updating tests |
chore |
Maintenance tasks |
feat(types): add AgentInterface struct for v1.0 RC
fix(server): handle missing Content-Type in JSON-RPC requests
test(serde): add round-trip tests for SecurityScheme variants
docs(readme): add SSE streaming example
Local hooks enforce this commit message format and run checks on git commit and git push.
-
Update your branch with the latest upstream changes:
git fetch upstream git rebase upstream/main
-
Ensure all checks pass:
cargo test --all-features cargo clippy --all-targets --all-features -- -D warnings cargo fmt --all -- --check cargo doc --no-deps --all-features -
Create the PR with a clear title and description
-
Fill out the PR template completely
-
Respond to review feedback promptly
Every type must have round-trip serialization tests using A2A spec JSON examples:
#[test]
fn agent_card_round_trip() {
let json = r#"{"name":"Test","description":"A test agent",...}"#;
let card: AgentCard = serde_json::from_str(json).unwrap();
let reserialized = serde_json::to_string(&card).unwrap();
let card2: AgentCard = serde_json::from_str(&reserialized).unwrap();
assert_eq!(card.name, card2.name);
}Use tower::ServiceExt to test handlers without starting a real HTTP server:
let app = a2a_rust::server::router(MockHandler::new());
let response = app.oneshot(request).await.unwrap();
assert_eq!(response.status(), StatusCode::OK);Use wiremock to mock A2A servers:
let mock_server = MockServer::start().await;
Mock::given(method("POST")).and(path("/rpc"))
.respond_with(ResponseTemplate::new(200).set_body_json(/* ... */))
.mount(&mock_server).await;There are two client test styles in this repo:
tests/client_integration.rsfor end-to-end behavior against the local axum servertests/client_wiremock.rsfor client-only transport and wire-shape tests
- Open a Discussion
- Check existing Issues
- Read the A2A Protocol Spec