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;
44pub mod task_store;
45pub mod types;
46
47pub use auth::RequestContext;
48pub use client::A2aClient;
49#[cfg(feature = "conformance")]
50pub use conformance::{run_conformance_suite, CaseStatus, ConformanceCase, ConformanceReport};
51pub use envelope::{codes, A2aHeaders, A2aMethod, JsonRpcError, JsonRpcRequest, JsonRpcResponse};
52pub use error::{A2aBuilderError, A2aError};
53pub use handler::A2aHandler;
54#[cfg(any(test, feature = "test-fixtures"))]
55pub use handler::EchoHandler;
56pub use server::{
57    A2aDispatcher, A2aDispatcherBuilder, A2aServer, TaskEvent, TaskEventSink, TaskEventStream,
58    LEADER_TTL,
59};
60pub use task_store::A2aTaskStore;
61pub use types::{
62    AgentCapabilities, AgentCard, AgentCardSignature, AgentInterface, AgentProvider, AgentSkill,
63    Artifact, CancelTaskParams, DeletePushNotificationConfigParams, GetExtendedAgentCardParams,
64    GetPushNotificationConfigParams, GetTaskParams, ListPushNotificationConfigsParams,
65    ListPushNotificationConfigsResult, ListTasksParams, ListTasksResult, Message, Part,
66    PushNotificationConfig, PushNotificationConfigParams, Role, SendMessageParams,
67    SendMessageResult, SubscribeToTaskParams, Task, TaskStatus,
68};