Skip to content

a2a_protocol_core

Crate: a2a_protocol_core · Path: crates/a2a_protocol_core
Description (Cargo.toml): Pure A2A (Agent-to-Agent) protocol domain logic - WASM optimized

Pure A2A v1.0.0 domain layer, completely transport-agnostic. Defines all protocol types (AgentCard, Task, Message, Artifact), JSON-RPC method params, security schemes, agent discovery, the method registry, and in-memory task storage. No HTTP, no Spin SDK — just domain logic that compiles everywhere.

From crates/a2a_protocol_core/Cargo.toml:

FeaturePurpose
defaultEnables protocol-core
protocol-coreBase Task + Message + AgentCard types (data, methods, services modules)
event-streamSSE streaming support (streaming module); requires protocol-core
file-handlingFile upload/download support; requires protocol-core
time-stampsTimestamp support for Task/Message via chrono
all-featuresEnables event-stream, file-handling, time-stamps
spec-compliantCore A2A spec features (protocol-core + event-stream)
wasm-optimizedMinimal features for WASM targets (protocol-core only)
coreBackward-compat alias for protocol-core
streamingBackward-compat alias for event-stream
timestampsBackward-compat alias for time-stamps
push-notificationsPush notification support; requires protocol-core
extended-discoveryExtended agent discovery; requires protocol-core

Modules: agent, error, protocol, registry, security, transport, data (feature protocol-core), methods (feature protocol-core), streaming (feature event-stream), services (feature protocol-core)

Always-available types:

  • AgentCard, AgentCapabilities, AgentCardSignature, AgentExtension, AgentInterface, AgentProvider, AgentSkill
  • A2AError, A2AResult, a2a_error_codes
  • A2AProtocol
  • A2AMethodRegistry, A2AMethodHandler, A2ANotificationHandler, MethodMetadata, RegistryStats
  • Security: SecurityScheme, SecurityRequirement, ApiKeySecurityScheme, HttpAuthSecurityScheme, OAuth2SecurityScheme, OAuthFlows, OpenIdConnectSecurityScheme, MutualTlsSecurityScheme, and OAuth flow types
  • A2ATransport, A2ATransportFactory traits

Feature-gated types (protocol-core):

  • Task, TaskState, TaskStatus, TaskPushNotificationConfig
  • Message, MessageRole, Part, Artifact, AuthenticationInfo
  • SendMessageRequest, SendMessageResponse, MessageSendParams, TaskGetParams, TaskListParams, TaskCancelParams, and related param/response types
  • AgentDiscovery, DefaultAgentDiscovery
  • TaskStorage, InMemoryTaskStorage, ConversationContext

Re-exports from protocol_transport_core: JsonRpcError, JsonRpcId, JsonRpcIncoming, JsonRpcRequest, JsonRpcResponse, JSONRPC_VERSION, jsonrpc_error_codes

Constant: A2A_PROTOCOL_VERSION ("1.0")

use a2a_protocol_core::{AgentCard, AgentSkill, Task, TaskState, Message, MessageRole, Part};
let card = AgentCard::new("my-agent".to_string());
let message = Message {
role: MessageRole::User,
parts: vec![Part::text("Hello, agent!")],
..Default::default()
};

Full API reference: cargo doc -p a2a_protocol_core --no-deps --all-features