Usage

Enagram exposes a simple HTTP API on your application's endpoint. You send interaction events to build up memory, then retrieve assembled working memory context to inject into your agent's prompt.

Your application's base URL and instance key are both shown in the API tab of the dashboard.


Authentication

All requests must include your instance key as a Bearer token:

Authorization: Bearer eng_...

Your instance key is unique to each application and is stored securely within the application. Retrieve it from the API tab — it is never stored in the dashboard database.


Sending events

POST /events ingests an interaction event into the memory pipeline. Events are scored for salience, compiled into episodes, and eventually promoted into semantic facts, procedures, and identity signals.

Request body

FieldTypeRequiredDescription
session_idstringYesGroups related events into a session. Use a consistent ID per conversation.
event_typestringYesType of event — e.g. user_message, assistant_message, outcome, correction.
payloadobjectYesArbitrary JSON — typically { "text": "..." } for message events.
outcomestringNopositive, negative, or neutral. Used for reinforcement learning.
occurred_atnumberNoUnix timestamp in milliseconds. Defaults to server time.

Response

Returns 200 OK with { "id": "...", "salience": 0.72, "stored": true }.

stored: false means the event was below the salience threshold and was not committed to memory.

const response = await fetch("https://{app-id}.api.enagram.io/events", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer eng_...",
  },
  body: JSON.stringify({
    session_id: "sess_001",
    event_type: "user_message",
    payload: { text: "I prefer concise answers." },
  }),
});

const { id, salience, stored } = await response.json();

Retrieving working memory

POST /working-memory assembles a prompt-ready context string from the agent's long-term memory, filtered and ranked for relevance to the current session.

Request body

FieldTypeRequiredDescription
session_idstringYesThe current session — used to weight recent context.
token_budgetnumberNoMax tokens to assemble. Defaults to the app's configured budget.
querystringNoOptional semantic query to bias memory retrieval toward a topic.

Response

Returns { "context": "...", "sources": [...] }. Prepend context to your system prompt before calling your LLM.

const response = await fetch("https://{app-id}.api.enagram.io/working-memory", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer eng_...",
  },
  body: JSON.stringify({
    session_id: "sess_001",
    token_budget: 2048,
    query: "user preferences",
  }),
});

const { context, sources } = await response.json();

// Prepend context to your system prompt
const systemPrompt = context + "\n\n" + yourBasePrompt;

Sending outcomes

Outcomes teach the memory pipeline what works. Sending a positive or negative outcome after an interaction adjusts salience weights and procedure success rates over time.

// Send a positive outcome after a successful interaction
await fetch("https://{app-id}.api.enagram.io/events", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer eng_...",
  },
  body: JSON.stringify({
    session_id: "sess_001",
    event_type: "outcome",
    outcome: "positive",
    payload: { text: "User confirmed the answer was helpful." },
  }),
});

Observing memory state

The /observe/* endpoints let you inspect the agent's memory directly without affecting it.

EndpointDescription
GET /observe/summaryCounts of events, episodes, facts, procedures, conflicts
GET /observe/eventsPaginated raw event log
GET /observe/episodesCompiled episodic memory
GET /observe/factsSemantic facts with confidence scores
GET /observe/identityIdentity signals (stable, seasonal, volatile)
GET /observe/proceduresLearned procedures with success rates

Health check

GET /health returns 200 OK when the instance is ready. Use this for readiness probes or uptime monitoring.