Layer 2 · intelligence
gateway
The one place model calls pass. A gateway holds upstreams, each an endpoint of agentic.model behind it. Every call by a caller principal on a route is decided once and recorded under its InferenceId: admitted, over-budget, rate-limited or no-upstream. An admitted call is completed with its usage and outcome; a refused call stays on record and cannot complete. A gateway that drains admits no new call.
Depends on
Used by
No block depends on this one.
Entities
Call
The record of one call, under the InferenceId it carries into agentic.model. Every call has one, whether it was admitted or not. Recorded until a call that was admitted completes; a refused call stays Recorded.
Identified by inference_id (InferenceId).
| field | type | meaning |
|---|---|---|
gateway_id | GatewayId | |
caller | PrincipalId | |
route_id | RouteId | |
admission | Admission | |
budget_left | Money | What the caller's budget held when the call was decided. |
upstream_id | UpstreamId | The upstream the gateway named for the route; for a no-upstream call it may name nothing that exists. |
usage | optional Usage | |
| outcome | optional InferenceOutcome |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Relations:
routereferences Route of model (one, byroute_id)upstreamreferences Upstream (one, byupstream_id)caller_principalreferences Principal of principal (one, bycaller)
Lifecycle of Call
Completed.Gateway
One gateway. Serving admits calls, Draining finishes what runs and admits nothing, Stopped is final.
Identified by gateway_id (GatewayId).
| field | type |
|---|---|
name | Name |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Relations:
upstreamsowns Upstream (many, bygateway_id)callsowns Call (many, bygateway_id)
Lifecycle of Gateway
Stopped.Upstream
An endpoint behind one gateway. Attached takes calls, Saturated has reached its rate limit and takes none until it recovers, Detached is gone.
Identified by upstream_id (UpstreamId).
| field | type |
|---|---|
gateway_id | GatewayId |
endpoint_id | EndpointId |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Relations:
endpointreferences Endpoint of model (one, byendpoint_id)
Lifecycle of Upstream
Detached.Commands
AdmitCall
Admit a call. Decide one call and record it. The gateway names the upstream it picked for the route and reports what the caller's budget holds; the answers are admitted, over-budget, rate-limited and no-upstream, and each leaves a record. A call on an unknown gateway, or on one that does not serve, is an error and leaves no record, except that a call naming an upstream that does not exist is recorded no-upstream whatever state the gateway is in. Not specified yet: how the gateway picks an upstream for a route is not modelled; and a draining gateway cannot refuse a call that names a missing upstream before recording it. ESS limit (0.99.17): a missing row answers before any row's state, and an outcome over the upstream's fields needs the missing-row outcome beside it (design/ess-repro/missing-row-before-state/; an ESS draft story lets a missing-row refusal answer before the held-state outcomes of its command).
Called by: Gateway.
| field | type |
|---|---|
inference_id | InferenceId |
gateway_id | GatewayId |
caller | PrincipalId |
route_id | RouteId |
upstream_id | UpstreamId |
budget_left | Money |
request | Content |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
unknown-gateway refused | no Gateway for gateway_ | Unknown: No gateway of this identity was opened. |
no-upstream | no Upstream for upstream_ | creates a Call in Recorded; emits Call |
gateway-not-serving refused | the Gateway of gateway_ has state != Serving | Gateway: The gateway is draining or stopped, so it admits no new call and takes no new upstream. |
no-upstream-detached | the Upstream of upstream_ has state == Detached | creates a Call in Recorded; emits Call |
no-upstream-foreign | the Upstream of upstream_ has gateway_ | creates a Call in Recorded; emits Call |
rate-limited | the Upstream of upstream_ has state == Saturated | creates a Call in Recorded; emits Call |
over-budget | budget_ | creates a Call in Recorded; emits Call |
admitted | otherwise | creates a Call in Recorded; emits Call |
More columns: swipe horizontally, or focus the table and use the arrow keys.
AttachUpstream
Attach an upstream.
Called by: Gateway operator.
| field | type |
|---|---|
upstream_id | UpstreamId |
gateway_id | GatewayId |
endpoint_id | EndpointId |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
unknown-gateway refused | no Gateway for gateway_ | Unknown: No gateway of this identity was opened. |
unknown-endpoint refused | no Endpoint for endpoint_ | Unknown: No endpoint of this identity is declared in agentic.. |
gateway-not-serving refused | the Gateway of gateway_ has state != Serving | Gateway: The gateway is draining or stopped, so it admits no new call and takes no new upstream. |
attached | otherwise | creates a Upstream in Attached; emits Upstream |
More columns: swipe horizontally, or focus the table and use the arrow keys.
CompleteCall
Complete a call.
Called by: Gateway.
| field | type |
|---|---|
inference_id | InferenceId |
| outcome | InferenceOutcome |
usage | Usage |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
not-admitted refused | admission != Admitted | Call: The call was refused at admission, so there is nothing to complete. |
completed | otherwise | moves the Call Recorded → Completed; emits Call |
wrong-state refused | the Call is in a state that does not allow it | Call: The call is not in a state this command acts from; it had already completed. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
DetachUpstream
Detach an upstream.
Called by: Gateway operator.
| field | type |
|---|---|
upstream_id | UpstreamId |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
detached | otherwise | moves the Upstream Attached, Saturated → Detached; emits Upstream |
wrong-state refused | the Upstream is in a state that does not allow it | Upstream: The upstream is not in a state this command acts from. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
DrainGateway
Drain a gateway.
Called by: Gateway operator.
| field | type |
|---|---|
gateway_id | GatewayId |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
draining | otherwise | moves the Gateway Serving → Draining; emits Gateway |
wrong-state refused | the Gateway is in a state that does not allow it | Gateway: The gateway is not in a state this command acts from. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
OpenGateway
Open a gateway.
Called by: Gateway operator.
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
opened | otherwise | creates a Gateway in Serving; emits Gateway |
More columns: swipe horizontally, or focus the table and use the arrow keys.
RestoreUpstream
Restore an upstream.
Called by: Gateway.
| field | type |
|---|---|
upstream_id | UpstreamId |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
restored | otherwise | moves the Upstream Saturated → Attached; emits Upstream |
wrong-state refused | the Upstream is in a state that does not allow it | Upstream: The upstream is not in a state this command acts from. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
SaturateUpstream
Mark an upstream saturated.
Called by: Gateway.
| field | type |
|---|---|
upstream_id | UpstreamId |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
saturated | otherwise | moves the Upstream Attached → Saturated; emits Upstream |
wrong-state refused | the Upstream is in a state that does not allow it | Upstream: The upstream is not in a state this command acts from. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
StopGateway
Stop a gateway.
Called by: Gateway operator.
| field | type |
|---|---|
gateway_id | GatewayId |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
stopped | otherwise | moves the Gateway Draining, Serving → Stopped; emits Gateway |
wrong-state refused | the Gateway is in a state that does not allow it | Gateway: The gateway is not in a state this command acts from. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Events
| event | fields | emitted by |
|---|---|---|
CallCompleted | inference_ InferenceId, outcome InferenceOutcome, usage Usage | Complete |
CallDecided | inference_ InferenceId, gateway_ GatewayId, caller PrincipalId, route_ RouteId, admission Admission, upstream_ UpstreamId, request Content | Admit |
GatewayDrained | gateway_ GatewayId | Drain |
GatewayOpened | gateway_ GatewayId, name Name | Open |
GatewayStopped | gateway_ GatewayId | Stop |
UpstreamAttached | upstream_ UpstreamId, gateway_ GatewayId, endpoint_ EndpointId | Attach |
UpstreamDetached | upstream_ UpstreamId | Detach |
UpstreamRestored | upstream_ UpstreamId | Restore |
UpstreamSaturated | upstream_ UpstreamId | Saturate |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Views
| view | rows | fields |
|---|---|---|
CallsCalls | each Call | inference_ InferenceId, gateway_ GatewayId, caller PrincipalId, route_ RouteId, admission Admission, budget_ Money, upstream_ UpstreamId, usage optional Usage, outcome optional InferenceOutcome, state State |
GatewaysGateways | each Gateway | gateway_ GatewayId, name Name, state State |
UpstreamsUpstreams | each Upstream | upstream_ UpstreamId, gateway_ GatewayId, endpoint_ EndpointId, state State |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Types
| type | is | values or fields |
|---|---|---|
AdmissionHow the gateway decided one call. | one of | Admitted, Over, Rate, No |
More columns: swipe horizontally, or focus the table and use the arrow keys.
KPIs
3 KPIs from the KPI catalogue. A gate must be zero for a variant of an architecture to count.
Completeness
| KPI | unit | better | gate | status |
|---|---|---|---|---|
call_record_shareShare of model calls that have a gateway record. How: Inferences started that have a CallDecided and a CallCompleted of the gateway, divided by inferences started. The gateway is the one place calls pass, so it must be 1. | share | higher | gate | planned source: design |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Quality
| KPI | unit | better | gate | status |
|---|---|---|---|---|
rate_limited_secondsTime requests waited because an upstream was saturated. How: Sum over upstreams of the seconds between UpstreamSaturated and the next UpstreamRestored, weighted by the calls held back in that interval. | seconds | lower | – | simulated source: design |
call_denied_shareShare of model calls the gateway refused at admission. How: CallDecided events with a refusal divided by all CallDecided events, by reason (budget, route, rate). | share | lower | – | planned source: design |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Settings
The settings a part of this block carries in an architecture document. agenticspec sim check refuses any other setting (setting_unknown) and a value outside its type (setting_invalid), and a part that lacks a setting marked required in the default column; the contract copies a setting into the ports it narrows. The last rows of each table are the settings every part takes. What no setting here types (a file, a path, an audience, the use of a model) goes into the part's notes, a map with free keys and values that the check takes as written and nothing reads.
A part gateway:
| setting | type | unit | default | contract | what |
|---|---|---|---|---|---|
rate_limit_per_minute | number of at least 0 | calls per minute | gateway. | The model calls the gateway admits per minute; without it, no limit. | |
count | integer of at least 1 | 1 | How many copies of the part run. | ||
per | part | One copy of the part for each copy of the named part. | |||
notes | notes | Free notes on the part, a map with keys and values of any kind: what no setting of its block types. The check takes any map; the simulator, the search and the contract never read it. |
More columns: swipe horizontally, or focus the table and use the arrow keys.