Intelligence Engine

You can now add an intelligence layer to your apps or games in minutes! Our cloud-based intelligence engine has memory to remember important events in your app or game's user sessions. You can create unique AI personalities that respond intelligently to guide, support, or manage your user experience.

Integration Flow

Follow these steps to integrate companions into your application.

1
Create Simulation
Set up your game world with a name and lore
2
Add NPCs
Create AI characters with descriptions and interests
3
Register Players
Create player sessions with optional expiry
4
Stream Events
Send game state & player questions via HTTP or WebSocket

Download API doc as Claude Skill

Authentication

All requests require these headers:

Authorization: Bearer <key>
Content-Type: application/json

Two key types are used:
API_KEY — Simulation, NPC, and Player read/delete operations
DISTR_KEY — Player create and all stream event operations

Login and go to your Dashboard to create your keys.

Simulations

A simulation represents your game world or app context. NPCs and players belong to a simulation.
There are tier based limits to how many simulations you can create for your account.

POST /simulation

Create a new simulation.

Request body
FieldTypeDescription
name string required Display name for the simulation
lore string required World-building text that NPCs use as context (max 2000 words). (Sample)
Response
{
  "sim_id": "si8a3f...",
  "name": "My Game",
  "lore": "me8f2a...",
  "creation_time": 1708646400
}
GET /simulation

List all simulations for your account.

Response
[
  { "sim_id": "si8a3f...", "name": "My Game", "lore": "...", "creation_time": 1708646400 },
  ...
]
GET /simulation/{sim_id}

Get a single simulation by ID.

PUT /simulation/{sim_id}

Update the simulation's lore/world description. Max 2000 words. Connected NPCs will restart to pick up the new lore.

FieldTypeDescription
lore string required World-building text that NPCs use as context
DELETE /simulation

Delete a simulation. All NPCs must be deleted first.

FieldTypeDescription
sim_id string required ID of the simulation to delete

NPCs

NPC companions that live inside a simulation. Each has a personality, description, and interests that shape their responses.
There are tier based limits to how many NPCs you can create per simulation for your account.

POST /npc

Create an NPC in a simulation.

FieldTypeDescription
sim_id string required Parent simulation ID
npc_name string required Display name
description string required Character personality, role, behavior
interests string[] required 5 sentences (up to 5-8 words each) to describe the NPC's events of interest. (Sample)
Response
{
  "npc_id": "npc7b2e...",
  "sim_id": "si8a3f...",
  "creation_time": 1708646500,
  "update_time": 1708646500
}
GET /simulation/{sim_id}/npcs

List all NPCs in a simulation.

GET /npc/{npc_id}

Get a single NPC by ID.

Response
{
  "npc_id": "npc7b2e...",
  "sim_id": "si8a3f...",
  "description": "...",
  "curr_interest_raw": ["phrase1", "phrase2", ...],
  "creation_time": 1708646500,
  "update_time": 1708646500
}
PUT /npc/{npc_id}

Update an NPC's description or interests.

FieldTypeDescription
description string optional Updated character personality/role
interests string[] optional Updated interest phrases (5 phrases, 5-8 words each)
DELETE /npc

Delete an NPC.

FieldTypeDescription
npc_id string required ID of the NPC to delete

Players

Players are user sessions within a simulation. Each player can send events and ask NPCs questions.

POST /user/player

Create a player session. Uses DISTR_KEY.

FieldTypeDescription
sim_id string required Simulation to join
expire_min int optional Session expiry in minutes
Response
{
  "player_id": "pl4c91...",
  "sim_id": "si8a3f...",
  "created_on": 1708646600,
  "connected_from": "...",
  "expires_on": 1708646900
}
GET /user/players?sim_id={sim_id}

List all players in a simulation.

GET /user/player/{player_id}?sim_id={sim_id}

Get a single player by ID.

DELETE /user/player

Delete a player session.

FieldTypeDescription
player_id string required Player to remove
sim_id string required Simulation the player belongs to

Stream Events

Send game state updates and player questions to NPCs. All event operations use DISTR_KEY.
Rate limits per player: 30/min (HTTP), 60/min (WebSocket).

POST /stream/event

Send a game state event. These are contextual updates that NPCs observe — things like "player entered dark forest zone" or "enemy defeated in arena".

FieldTypeDescription
player_id string required
sim_id string required
event_kind "state" required
event string required Short natural-language event (5-8 words). (Sample)
event_id string optional Your own event identifier for deduplication
Example
{
  "player_id": "pl4c91...",
  "sim_id": "si8a3f...",
  "event_kind": "state",
  "event": "player entered dark forest zone"
}
POST /stream/event

Ask a specific NPC a question. The NPC responds based on its personality, the simulation lore, and recent game state.

FieldTypeDescription
player_id string required
sim_id string required
event_kind "ask" required
npc_id string required Which NPC to ask
ask_text string required A question for the NPC
ask_id string optional An optional identifier to correlate response
Example
{
  "player_id": "pl4c91...",
  "sim_id": "si8a3f...",
  "event_kind": "ask",
  "npc_id": "npc7b2e...",
  "ask_text": "what should i do next?"
}

WebSocket WS

For high-frequency event streaming, connect via WebSocket instead of individual HTTP calls.

WSS /stream/event/ws/{sim_id}/{player_id}

Open a persistent connection and send JSON messages. Auth headers go in the WebSocket handshake.

Connection headers
Authorization: Bearer <DISTR_KEY>
Send state events
{ "event_kind": "state", "event": "player picked up legendary sword" }
Send ask events
{ "event_kind": "ask", "npc_id": "npc7b2e...", "ask_text": "where is the hidden temple?" }
Close connection
{ "cmd": "close" }

Login

or