Skip to Content
The Ngamia platform API is in preview. Endpoints may change before general availability.
Platform internalsLife of a run

Life of a run

  1. Request. Your server calls POST /v1/agents/{slug}/runs with an API key and user, or a person calls it with their token.
  2. Gate. The platform authenticates the credential, checks the runs scope or role, the agent (exists, not archived) and the rate limit.
  3. Assertion. The platform signs a service assertion (nak-te-assertion-v1) and calls NAK. The assertion is an Ed25519 JWT with issuer ngamia-platform, audience ngamia-nak and app platform, scoped to the workspace and subject. It lives at most 60 s and NAK accepts its jti once.
  4. 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.
  5. 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 with memory: true.
  6. Limits. Each run stops at max_steps model calls or max_total_tokens. Tool output, evidence and model output are capped, and each model attempt and tool call has a timeout.
  7. Citations. Before the answer is stored, citations to passages that were not retrieved are removed, and real ones are numbered and listed under Sources:.
  8. 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.