Skip to main content

brainwires_a2a/
lib.rs

1#![deny(missing_docs)]
2//! # brainwires-a2a
3//!
4//! Agent-to-Agent (A2A) protocol implementation with JSON-RPC, REST, and gRPC bindings.
5//!
6//! ## Features
7//!
8//! - `client` — HTTP client for JSON-RPC and REST (reqwest)
9//! - `server` — HTTP server for JSON-RPC and REST (hyper)
10//! - `native` — Both client and server (default)
11//! - `grpc` — gRPC types (prost + tonic)
12//! - `grpc-client` — gRPC client transport
13//! - `grpc-server` — gRPC server service
14//! - `full` — Everything
15
16// Core types (always available)
17/// Agent card and capability types.
18pub mod agent_card;
19/// Type conversions between serde and proto types.
20pub mod convert;
21/// Error types and JSON-RPC error codes.
22pub mod error;
23/// JSON-RPC 2.0 envelopes and method constants.
24pub mod jsonrpc;
25/// Typed request parameter structs.
26pub mod params;
27/// Generated proto types (gRPC feature).
28pub mod proto;
29/// Push notification configuration types.
30pub mod push_notification;
31/// Streaming event types.
32pub mod streaming;
33/// Task lifecycle types: Task, TaskStatus, TaskState.
34pub mod task;
35/// Core message types: Message, Part, Artifact, Role.
36pub mod types;
37
38// Client (feature-gated)
39/// A2A client with transport selection.
40#[cfg(feature = "client")]
41pub mod client;
42
43// Server (feature-gated)
44/// A2A server serving all protocol bindings.
45#[cfg(feature = "server")]
46pub mod server;
47
48// Re-exports for convenience
49pub use agent_card::{
50    AgentCapabilities, AgentCard, AgentCardSignature, AgentExtension, AgentInterface,
51    AgentProvider, AgentSkill, ApiKeySecurityScheme, AuthorizationCodeOAuthFlow,
52    ClientCredentialsOAuthFlow, DeviceCodeOAuthFlow, HttpAuthSecurityScheme, ImplicitOAuthFlow,
53    MutualTlsSecurityScheme, OAuth2SecurityScheme, OAuthFlows, OpenIdConnectSecurityScheme,
54    PasswordOAuthFlow, SecurityRequirement, SecurityScheme,
55};
56pub use error::A2aError;
57pub use jsonrpc::{JsonRpcRequest, JsonRpcResponse, RequestId};
58pub use params::*;
59pub use push_notification::{AuthenticationInfo, TaskPushNotificationConfig};
60pub use streaming::{
61    SendMessageResponse, StreamResponse, TaskArtifactUpdateEvent, TaskStatusUpdateEvent,
62};
63pub use task::{Task, TaskState, TaskStatus};
64pub use types::{Artifact, Message, Part, Role};
65
66#[cfg(feature = "client")]
67pub use client::{A2aClient, Transport};
68
69#[cfg(feature = "server")]
70pub use server::{A2aHandler, A2aServer};