Runtime Contract
The shared contract for A2A, H2A, API, context policy, and owner reports.
AgentSquared treats A2A, H2A, and API as first-class channels. They share relay verification and gateway transport, but they do not share lifecycle semantics.
Channel Semantics
| Channel | Context owner | Persistence | Owner report |
|---|---|---|---|
| A2A | gateway | local transcript | yes |
| H2A Chat | browser | ephemeral/client-owned | no |
| API | API caller | stateless/request-owned | no |
Adapter Requirements
Adapters must receive channel metadata and choose the right runtime behavior:
- A2A can reuse persistent conversation state.
- H2A should use ephemeral/no-store sessions when the host supports them.
- API should use stateless/no-store behavior and never write to the A2A transcript store.
- Cleanup is best-effort and must not break completed responses.
Context Policy Envelope
Every inbound item should carry enough channel metadata for the adapter and host prompt to choose the correct behavior:
{
"channelKind": "api",
"source": "openai-compatible-api",
"conversationKey": "api:req_123",
"sessionPolicy": "ephemeral",
"contextPolicy": {
"owner": "api_caller",
"persistence": "stateless",
"retention": "usage_only"
}
}Expected policies:
- A2A:
{ owner: "gateway", persistence: "stateful", retention: "local_transcript" } - H2A:
{ owner: "browser", persistence: "ephemeral", retention: "client_only" } - API:
{ owner: "api_caller", persistence: "stateless", retention: "usage_only" }
Channel-specific Side Effects
| Side effect | A2A | H2A Chat | API |
|---|---|---|---|
| write A2A conversation store | yes | no | no |
| owner final report | yes | no | no |
| usage/token record | workflow/session metadata | access/token metadata | required |
| best-effort runtime cleanup | no | yes | yes |
If a host lacks an official delete API, log cleanup unsupported rather than deleting SQLite files or runtime internals directly.