Overview
The protocol has two halves: a data format — the manifest, which a game uses to describe itself — and messages the game sends to a decision service: four in the main loop and one to update context.
A third part is proposed: the policy format, a portable file that lets a game make decisions locally with a small model trained on the service’s decisions.
Message flow
Section titled “Message flow”- Session. At start the game announces the protocol version and its manifest. When a level or character appears later,
/v1/contextadds its scope or profile. - Decide. On events or on a slow timer the game sends a batch of entities that need a decision. The service asks the model one typed question per entity and returns one decision each.
- Execute. The game validates each decision and executes it, or runs its native AI.
- Report. When a decision ends, the game reports how; this becomes the entity’s memory.
- Telemetry. About once per second, in every mode, the game sends what is actually happening.
Endpoints
Section titled “Endpoints”| Endpoint | Purpose |
|---|---|
POST /v1/session |
Announce the game, protocol version and manifest |
POST /v1/context |
Add, replace or remove scopes and profiles during a session |
POST /v1/decide |
Ask for actions for a batch of entities |
POST /v1/report |
Report what happened to a decision |
POST /v1/telemetry |
Periodic snapshot for observability |
GET /health |
Unauthenticated liveness and a2g version. Only the local profile may also show the model and whether a key is configured |
/health does not prove that a provider call will succeed.
Transport
Section titled “Transport”- JSON over HTTP,
POSTwithContent-Type: application/json. Body size is limited to 256 KiB. - HTTPS is required outside loopback.
/v1/sessionis authenticated with an API key or a join token; every later request carries the returned session token. See Security. - The reference service listens on
127.0.0.1:8787only (thelocalprofile). Even there, a service must checkHost,OriginandContent-Typeso web pages in the developer’s browser cannot reach it (local-profile checks). - Errors:
400invalid input,401bad or expired credential,403not allowed (for example an unregistered manifest),409unknown session — resend/v1/session,429rate limit withRetry-After. The game must treat any non-200reply as “no decision” and run its native AI.
Versioning
Section titled “Versioning”The game sends "a2g": "0.1" in /v1/session. A service that does not support that version rejects the session with 400. Responses to /v1/session and /v1/decide carry the service’s a2g version.
Identifiers
Section titled “Identifiers”client_id— one running game process. A restarted game is a new client and must send a new session.- entity
id— unique within a client; the game chooses it.