Life of a run
- Request. Your server calls
POST /v1/agents/{slug}/runswith an API key anduser, or a person calls it with their token. - Gate. The platform authenticates the credential, checks the
runsscope or role, the agent (exists, not archived) and the rate limit. - Assertion. The platform signs a service assertion
(
nak-te-assertion-v1) and calls NAK. The assertion is an Ed25519 JWT with issuerngamia-platform, audiencengamia-nakand appplatform, scoped to the workspace and subject. It lives at most 60 s and NAK accepts itsjtionce. - Definition. NAK runs with
NAK_AGENT_SOURCE=platform. It fetches the agent definition (GET /internal/v1/agents/{slug}) and the workspace runtime settings (GET /internal/v1/workspace-runtime: model key, default model, knowledge read key) from the platform, signing its own assertion back. Definitions are cached for 30 s, or 3 s while a workspace still lacks a model key or knowledge. - Loop. NAK calls the model through the Ngamia gateway with the
workspace’s key and the agent’s model. When the model asks for
knowledge_search, NAK searches UBONGO with the workspace’s read-only key. TE tools run only if they are both on the agent and on the operator’s allowlist. Memory is recalled only for agents withmemory: true. - Limits. Each run stops at
max_stepsmodel calls ormax_total_tokens. Tool output, evidence and model output are capped, and each model attempt and tool call has a timeout. - Citations. Before the answer is stored, citations to passages that were not retrieved are removed, and real ones are numbered and listed under Sources:.
- Record. Every step is an event in NAK’s durable log (PostgreSQL). The platform relays the outcome, or the event stream over SSE.
Runs pin the definition and tool catalog they started with, so editing an
agent never changes a run in progress. NAK replicas pick up unfinished runs
(continue), and event streams work from any replica because they read the
log.