1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! A2A Protocol v1.0 server framework.
//!
//! `turul-a2a` provides the server side of the [A2A
//! Protocol](https://github.com/a2aproject/A2A): a typed
//! [`executor::AgentExecutor`] trait, HTTP + JSON-RPC transports, Server-Sent
//! Events streaming, and a storage abstraction with four backends
//! (in-memory, SQLite, PostgreSQL, DynamoDB) — all proto-normative per
//! `proto/a2a.proto`.
//!
//! # Quick start
//!
//! See the `examples/echo-agent` crate for a runnable end-to-end example.
//! A minimal executor implements [`executor::AgentExecutor`] and is passed to
//! [`A2aServer::builder()`]:
//!
//! ```text
//! let server = A2aServer::builder()
//! .executor(MyExecutor)
//! .bind(([0, 0, 0, 0], 3000))
//! .build()?;
//! server.run().await?;
//! ```
//!
//! # Feature flags
//!
//! - `in-memory` (default) — volatile in-process storage
//! - `sqlite` — SQLx SQLite backend (atomic task+event writes)
//! - `postgres` — SQLx PostgreSQL backend
//! - `dynamodb` — AWS DynamoDB backend with TTL
//! - `compat-v03` — opt-in compatibility shim for a2a-sdk 0.3.x clients
//! (method name normalization, root POST route, optional `A2A-Version`
//! header). Canonical builds are v1.0 strict.
//!
//! # Durable event coordination
//!
//! Task state and streaming events are written atomically via
//! [`storage::A2aAtomicStore`]. The in-process event broker is a local
//! wake-up signal; the storage backend is the source of truth. Subscribers
//! attached while a task is non-terminal receive replay of prior events and
//! then live delivery, supporting `Last-Event-ID` reconnection across
//! instances when the same backend is used (e.g., shared DynamoDB or
//! PostgreSQL). Subscribing to an already-terminal task returns
//! `UnsupportedOperationError` per A2A v1.0 §3.1.6 — use [`storage`] or
//! `GetTask` to retrieve the final state.
//!
//! # Multi-instance streaming
//!
//! The in-process [`streaming`] broker fans out to clients on the same
//! process only. Cross-instance streaming relies on the shared durable event
//! store for replay. For horizontally scaled deployments, configure all
//! instances against the same backend.
pub use A2aServer;