Skip to main content

klieo_a2a/
lib.rs

1#![deny(missing_docs)]
2#![deny(rust_2018_idioms)]
3#![deny(rustdoc::broken_intra_doc_links)]
4
5//! Durable A2A v1.0 protocol layer for klieo agents.
6//!
7//! Implements the [Agent-to-Agent (A2A) v1.0 specification](https://a2a-protocol.org/latest/specification/)
8//! wire types, JSON-RPC envelope, and a server-side dispatcher atop
9//! [`klieo_core::Pubsub`] + [`klieo_core::KvStore`].
10//!
11//! # Why durable A2A?
12//!
13//! Today A2A runs over HTTP/JSON-RPC + WebSocket. Klieo's angle:
14//! implement the same wire shape over **NATS JetStream + KV +
15//! JobQueue**. Inter-agent calls inherit the durability, leasing,
16//! dedup, and DLQ semantics of [`klieo_core::JobQueue`] — *A2A but
17//! work-doesn't-get-stuck.*
18//!
19//! Wire-compatible at the JSON-RPC envelope level: a payload
20//! produced by `adk-python` deserialises into our `SendMessageParams`
21//! cleanly. Only the transport differs.
22//!
23//! # Architecture asymmetry
24//!
25//! [`server::A2aServer`] takes `Arc<dyn Pubsub>` (not
26//! `Arc<dyn RequestReply>`) because `klieo-core`'s
27//! [`klieo_core::RequestReply`] trait is *client-side only*. The
28//! server listens on `<app_prefix>.a2a.<agent_id>.rpc` via
29//! [`klieo_core::Pubsub::subscribe`] and replies by publishing on a
30//! per-request reply subject extracted from message headers. A typed
31//! server-side trait would tighten the API; deferred until a second
32//! protocol-server consumer exists.
33
34pub mod auth;
35pub mod client;
36#[cfg(feature = "conformance")]
37pub mod conformance;
38pub mod envelope;
39pub mod error;
40pub mod handler;
41#[cfg(feature = "http")]
42pub mod http;
43pub mod server;
44mod ssrf;
45pub mod task_store;
46pub mod types;
47
48pub use auth::RequestContext;
49pub use client::A2aClient;
50#[cfg(feature = "conformance")]
51pub use conformance::{run_conformance_suite, CaseStatus, ConformanceCase, ConformanceReport};
52pub use envelope::{codes, A2aHeaders, A2aMethod, JsonRpcError, JsonRpcRequest, JsonRpcResponse};
53pub use error::{A2aBuilderError, A2aError};
54pub use handler::A2aHandler;
55#[cfg(any(test, feature = "test-fixtures"))]
56pub use handler::EchoHandler;
57pub use server::{
58    A2aDispatcher, A2aDispatcherBuilder, A2aServer, TaskEvent, TaskEventSink, TaskEventStream,
59    LEADER_TTL,
60};
61pub use task_store::A2aTaskStore;
62pub use types::{
63    AgentCapabilities, AgentCard, AgentCardSignature, AgentInterface, AgentProvider, AgentSkill,
64    Artifact, CancelTaskParams, DeletePushNotificationConfigParams, GetExtendedAgentCardParams,
65    GetPushNotificationConfigParams, GetTaskParams, ListPushNotificationConfigsParams,
66    ListPushNotificationConfigsResult, ListTasksParams, ListTasksResult, Message, Part,
67    PushNotificationConfig, PushNotificationConfigParams, Role, SendMessageParams,
68    SendMessageResult, SubscribeToTaskParams, Task, TaskStatus,
69};