Runtime

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

ChannelContext ownerPersistenceOwner report
A2Agatewaylocal transcriptyes
H2A Chatbrowserephemeral/client-ownedno
APIAPI callerstateless/request-ownedno

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 effectA2AH2A ChatAPI
write A2A conversation storeyesnono
owner final reportyesnono
usage/token recordworkflow/session metadataaccess/token metadatarequired
best-effort runtime cleanupnoyesyes

If a host lacks an official delete API, log cleanup unsupported rather than deleting SQLite files or runtime internals directly.