Executive
Gives an agent access to a model. The Executive offers one OpenAI-compatible API, translates each call to whichever provider serves the model, counts the tokens, and decides whether a given agent may use a given model. What the agent then does with the model is the cartridge’s business.
- Design rules
- M1 to M4, E5, E7
- Contracts offered
- 2
- Key flows
- 3
On the job
- Publishes the catalog of offered models under neutral names
- Checks an agent’s allowed models, the factory default and a run’s pin
- Translates a call to the provider’s native API and the answer back
- Counts input, output and cache tokens, streaming or not
Not my job
- Hold a credential or answer an HTTP request. The Gatekeeper does both.
- Set prices or decide standing. That is the Treasurer.
- Choose what an agent says or remembers. That is the cartridge.
What Executive does, step by step
Serve one model call
complete never throws. It returns a result, a refusal made before any provider was called, or the upstream failure.
The Gatekeeper hands over the parsed request.
The Executive validates it against the OpenAI chat rules (M1) and finds the model in the catalog.
It picks the adapter for the model’s provider and translates the request to that provider’s native API.
The answer is translated back to OpenAI format and returned with the token usage.
Decide whether an agent may use a model
Plain values in, so the Executive never imports the control plane’s policy type.
The caller passes the agent’s allow-list, the model asked for, whether it is a training run and any pin on the run.
checkModel answers allowed or the reason it is not. When a policy names no models, the factory default applies.
offeredModels lists the names an agent may pick from, for the console’s policy tab.
Count tokens and report usage
E5. The count belongs here; the price does not.
usageFromJson reads usage from a normal reply; SseMeter reads it from a stream as it passes.
The usage goes to the Treasurer as input, output, cacheRead and cacheWrite tokens.
Works with Treasurer· contractcostUsd / priceFor →The Executive depends on the Treasurer for the Price and TokenUsage types only.Metrics and a trace of the call are recorded.
Contracts Executive keeps 2 offered
- completeused by Gatekeeper
- checkModel / offeredModelsused by Gatekeeper