Pre-alpha 文档
在不泄露 Wire Type 的前提下提供 A2A 1.0。
通过有界 StateKnot 合约、Authorization-first Policy、显式 Admission 与可恢复 Application Interface 暴露 HTTP+JSON 和 JSON-RPC/SSE。
让 Identity 先于 Parsing
- 校验 Shutdown State、Host、Origin、Path、Content Type 与 Body Ceiling。
- 获取进程内 Request Capacity。
- 在解析 Request Body 前认证 Bearer Credential。
- 解码并校验有界 A2A Operation。
- 在 Task/Push-config Lookup 前授权 Decoded Operation。
- 执行调用方实现的 Replica-wide Quota Admission。
- 执行可恢复 Service,并限制 Unary Response 或整个 Stream。
Agent Card Discovery 是唯一 Public Route,带完整 Cache Validator。若其 Capability 或 Interface URL 与挂载 Service 不一致,启动构建直接失败。
一份 Application 合约,两种 Binding
| Surface | HTTP+JSON | JSON-RPC | 持久执行要求 |
|---|---|---|---|
| Send / Get / List | 是 | 是 | Idempotency、Tenant-scoped Projection、Stable Cursor |
| Stream / Subscribe | SSE | SSE | 先 Snapshot,再输出已提交有序 Event |
| Cancel | 是 | 是 | 持久化 Intent 与 Race-safe Lifecycle Fence |
| Push Config CRUD | 是 | 是 | Secret 加密、Egress Policy、Transactional Outbox |
| Extended Agent Card | 是 | 是 | Authenticated Caller-scoped Projection |
StateKnot 自有并限制 Agent Card、Message、Part、Task、Artifact、Update 与 Push Config。固定版本的官方 SDK 只是 Private Wire Adapter。ProtoJSON 要求的 Unknown Field 会被忽略;非法 Enum、Lifecycle Combination、Version、 Route、Media 与 Limit 一律 Fail Closed。
只在启动时构建一次
let options = A2aServerHttpOptions::new()
.with_allowed_authorities(["agents.example.com"])?
.with_allowed_origins(["https://console.example.com"])?
.with_limits(1_048_576, 1_024, 512)?
.with_timeouts(Duration::from_secs(30), Duration::from_secs(60))?
.with_maximum_stream_events(16_384)?
.with_bearer_challenge("Bearer realm=\"stateknot-a2a\"")?;
let shutdown = CancellationToken::new();
let server = A2aServer::new(
card,
authenticator,
authorizer,
shared_admission,
durable_task_service,
options,
shutdown.clone(),
)?;
axum::serve(listener, server.router())
.with_graceful_shutdown(shutdown.cancelled_owned())
.await?;
使用生产基础设施实现 A2aServerAuthenticator、
A2aServerAuthorizer、A2aServerAdmissionControl 与
A2aTaskService。TLS 和可信 Proxy Termination 位于 Router
外层;配置应用实际看到的精确 Authority。
进程内存不能提供持久性保证
生产 Task Service 必须基于持久化记录去重 Message Identity、在一个 Tenant 内映射 Opaque Task ID、从 Stable Snapshot 分页、流式输出已提交 Journal Evidence、 提交 Cancellation Intent、加密 Push Credential、拒绝不安全 Destination, 并从 Transactional At-least-once Outbox 投递。仓库内的 In-memory Fixture 只服务于确定性 TCK Scenario。
暴露流量或发布兼容性声明前,请阅读完整生产检查清单和精确 Conformance 边界。