Skip to content

Simulations

Simulations are the core resource of the Kairos API. You can create them from pre-built scenarios or custom configurations, advance them tick-by-tick or in bulk, retrieve their full execution trace, and control agent policies and playback in real time.

All simulation endpoints require authentication. Write operations require the simulation:write scope; read operations require simulation:read.

POST /v1/simulations

Creates a new simulation instance. Provide either a scenarioId (to use a pre-built scenario) or an inline scenario object — not both.

FieldTypeRequiredDescription
scenarioIdstringOne ofID of a pre-built scenario
scenarioobjectOne ofInline scenario configuration
scenario.seednumberYesRandom seed
scenario.agentsAgent[]YesAgent configurations
scenario.initialStateobjectYesStarting state
organizationIduuidNoOrganization to bill against
engineVersionstringNoPin a specific engine version
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"scenarioId": "capability-divergence",
"engineVersion": "1.4.4",
"state": { }
}
Terminal window
curl -X POST https://api.anankelabs.ai/v1/simulations \
-H "X-Api-Key: krs_..." \
-H "Content-Type: application/json" \
-d '{"scenarioId": "capability-divergence"}'
POST /v1/simulations/from-domain

Creates a simulation using a domain adapter. Domain adapters translate domain-specific input (e.g., AI Safety vocabulary) into the engine’s native scenario format.

FieldTypeRequiredDescription
domainstringYesDomain adapter identifier (e.g., "ai-safety")
inputobjectYesDomain-specific input payload
organizationIduuidNoOrganization to bill against
engineVersionstringNoPin a specific engine version

Same shape as Create Simulation.

StatusCodeWhen
404NOT_FOUNDUnknown domain adapter
POST /v1/simulations/run

Creates and executes a simulation in a single request, returning the complete trace. This is the most convenient endpoint for batch workloads.

FieldTypeRequiredDescription
scenarioIdstringOne ofPre-built scenario ID
domainstringOne ofDomain adapter identifier
inputobjectWith domainDomain-specific input payload
ticksnumberYesNumber of ticks to simulate (1–10,000)
organizationIduuidNoOrganization to bill against
engineVersionstringNoPin a specific engine version

Set Accept: application/x-ndjson to receive the trace as newline-delimited JSON, where each line is a trace step. This is useful for large simulations that would be expensive to buffer in memory.

{
"simulationId": "a1b2c3d4-...",
"engineVersion": "1.4.4",
"trace": {
"metadata": { },
"initialState": { },
"steps": [
{
"tick": 0,
"move": "idle",
"state": { },
"warning": null,
"loss": null,
"agents": [
{
"id": "frontier_model",
"state": { },
"policy": { "lambda": 0.5, "gamma": 0.3 }
}
]
}
]
}
}
Terminal window
curl -X POST https://api.anankelabs.ai/v1/simulations/run \
-H "X-Api-Key: krs_..." \
-H "Content-Type: application/json" \
-d '{"scenarioId": "capability-divergence", "ticks": 500}'
Terminal window
curl -X POST https://api.anankelabs.ai/v1/simulations/run \
-H "X-Api-Key: krs_..." \
-H "Accept: application/x-ndjson" \
-H "Content-Type: application/json" \
-d '{"scenarioId": "capability-divergence", "ticks": 500}'
GET /v1/simulations

Returns a paginated list of simulations accessible to the authenticated identity.

ParameterTypeDefaultDescription
organizationIduuidFilter by organization (JWT users only; API keys use their own org)
limitinteger50Results per page (1–200)
offsetinteger0Pagination offset
{
"data": [
{
"id": "a1b2c3d4-...",
"scenarioId": "capability-divergence",
"organizationId": "org-uuid",
"createdAt": "2025-06-15T10:30:00.000Z",
"state": { }
}
],
"pagination": {
"limit": 50,
"offset": 0,
"total": 142
}
}
Terminal window
curl "https://api.anankelabs.ai/v1/simulations?limit=10" \
-H "X-Api-Key: krs_..."
GET /v1/simulations/{id}

Returns the current state of a single simulation.

ParameterTypeDescription
iduuidSimulation ID
{
"id": "a1b2c3d4-...",
"scenarioId": "capability-divergence",
"organizationId": "org-uuid",
"state": { },
"createdAt": "2025-06-15T10:30:00.000Z"
}
StatusCodeWhen
401UNAUTHORIZEDNot authorized to access this simulation
404NOT_FOUNDSimulation does not exist
POST /v1/simulations/{id}/step

Advances an existing simulation by a given number of ticks.

ParameterTypeDescription
iduuidSimulation ID
FieldTypeRequiredDescription
ticksnumberYesNumber of ticks to advance (1–10,000)
{
"state": { },
"ticks": 100
}
Terminal window
curl -X POST https://api.anankelabs.ai/v1/simulations/a1b2c3d4-.../step \
-H "X-Api-Key: krs_..." \
-H "Content-Type: application/json" \
-d '{"ticks": 100}'
GET /v1/simulations/{id}/trace

Returns the full execution trace for a simulation that has been run. Supports both JSON and NDJSON streaming via the Accept header.

ParameterTypeDescription
iduuidSimulation ID
{
"metadata": { },
"initialState": { },
"steps": [
{
"tick": 0,
"move": "idle",
"state": { },
"warning": null,
"loss": null,
"agents": [
{
"id": "frontier_model",
"state": { },
"policy": { "lambda": 0.5, "gamma": 0.3 }
}
]
}
]
}
FieldTypeDescription
ticknumberThe simulation tick number
movestringThe move that was applied
stateobjectFull simulation state at this tick
warningobject | nullWarning if stability threshold was crossed
lossobject | nullBasin loss event, if one occurred
agentsAgent[]Per-agent state and policy snapshot
StatusCodeWhen
404NOT_FOUNDSimulation not found or trace not yet available
Terminal window
curl https://api.anankelabs.ai/v1/simulations/a1b2c3d4-.../trace \
-H "X-Api-Key: krs_..." \
-H "Accept: application/x-ndjson"
PUT /v1/simulations/{id}/agent-policy

Updates the policy parameters for a specific agent within a running simulation.

ParameterTypeDescription
iduuidSimulation ID
FieldTypeRequiredDescription
agentIdstringYesThe agent to update
policy.lambdanumberNoNew lambda (latency/chaos) parameter
policy.gammanumberNoNew gamma (capacity/order) parameter
{ "ok": true }
Terminal window
curl -X PUT https://api.anankelabs.ai/v1/simulations/a1b2c3d4-.../agent-policy \
-H "X-Api-Key: krs_..." \
-H "Content-Type: application/json" \
-d '{"agentId": "frontier_model", "policy": {"lambda": 0.7}}'
PUT /v1/simulations/{id}/time-control

Controls playback of a running simulation — play, pause, or single-step.

ParameterTypeDescription
iduuidSimulation ID
FieldTypeRequiredDescription
actionstringYesOne of "play", "pause", or "step"
speednumberNoPlayback speed multiplier (0.1–10)
{ "ok": true }
Terminal window
curl -X PUT https://api.anankelabs.ai/v1/simulations/a1b2c3d4-.../time-control \
-H "X-Api-Key: krs_..." \
-H "Content-Type: application/json" \
-d '{"action": "play", "speed": 2.0}'