iblai-api-agent-memory
Manage an agent's memories through the API: browse and filter what an agent has
remembered, curate global (cross-agent) memories, add / edit / delete individual
memories, manage the categories memories are filed under, and control capture /
recall settings. Use when inspecting or curating what an agent remembers.
Auth & conventions
- Base URL:
https://api.iblai.app
- Header:
Authorization: Api-Token $IBLAI_API_KEY on every request.
- Path vars:
{org} = $IBLAI_ORG, {username} = $IBLAI_USERNAME,
{mentor} = the agent's unique id (e.g. d17dc729-60fd-4363-81a0-f67d9318b03e).
- Prefix / two spellings: endpoints live under the
ai-mentor base
https://api.iblai.app/dm/api/ai-mentor/orgs/{org} (the leading … below). A twin
ai-agent base mirrors every route with the mentor path token swapped for agent
(…/mentors/{mentor}/mentor-memories/ ↔ …/agents/{agent}/agent-memories/); either works.
- Two path bases: user-scoped routes hang off
…/orgs/{org}/users/{username} (written
{u} below); memory categories hang off …/orgs/{org}/mentors/{mentor} directly (no
user segment).
- Not connected yet? Run
/iblai-api-login first to populate IBLAI_ORG,
IBLAI_USERNAME, and IBLAI_API_KEY.
Concepts
Two PGVector-backed memory stores ("memsearch") sit behind these endpoints:
- Global memories (
UserGlobalMemory) — scoped to a user + org, shared across every
agent; facts any agent should know about the user.
- Agent memories (
UserMentorMemory) — scoped to a user + one agent + a
category; what a single agent remembers about the user.
- Agent knowledge (
MentorMemory) — scoped to one agent (org + agent), not any
user and not categorized. Manually curated (never auto-extracted), it is injected into
every user's chat with that agent as an ## Agent Knowledge block, gated by the agent's
enable_memory_component and each user's use_memory_in_responses. This is shared "how the
agent should behave / what it should always know" content, distinct from the per-user stores
above.
Categories (MentorMemoryCategory, per agent) file agent memories and steer capture:
each has a slug, an extraction_prompt (LLM hint for what to pull into that category),
and is_active (whether it's used during extraction).
Capture & injection are controlled per user via memsearch-settings:
auto_capture_enabled — agents auto-extract memories from conversations. Auto-extracted
rows carry is_auto_generated: true; memories you add via the API are false.
use_memory_in_responses — stored memories are injected into agent responses.
An org-wide enable_memsearch flag gates the whole feature (see memsearch-status).
Reads
Agent memories
- GET
…/users/{username}/mentors/{mentor}/mentor-memories-list/?page={n}&page_size={n}&category={slug}&my_memory={bool}&user_id={id}&email={e}&start_date={yyyy-MM-dd}&end_date={yyyy-MM-dd} — paged flat list for one agent.
- GET
…/users/{username}/mentors/{mentor}/mentor-memories/?my_memory={bool}&user_id={id}&email={e}&start_date=&end_date= — the same memories grouped by category.
- GET
{u}/mentor-memories/?mentor={agent}&user_id={id}&email={e}&start_date=&end_date= — the user's agent memories across all agents; add ?mentor= to scope to one. Twin spelling: {u}/agent-memories/.
Categories
- GET
…/orgs/{org}/mentors/{mentor}/memory-categories/ — category list for one agent.
Agent knowledge (shared)
- GET
…/orgs/{org}/mentors/{mentor}/agent-memories/?page={n}&page_size={n} — paged list of the agent's shared knowledge entries (DRF page envelope; page_size default 20, max 100). This path has no users/{username} segment — do not confuse it with the user-scoped {u}/agent-memories/ twin spelling above, which lists one user's per-agent memories.
Global (cross-agent) memories
- GET
{u}/global-memories/?user_id={id}&email={e}&session_id={uuid}&content={substr}&start_date={yyyy-MM-dd}&end_date={yyyy-MM-dd} — user-level memories shared across every agent. Filters: session_id (the source session), content (case-insensitive substring), and the start_date / end_date created-at range.
Settings
- GET
{u}/memsearch-settings/ — the user's capture / recall settings. Organization admins may read another user's settings by putting that user's username in the {username} path segment; non-admins are restricted to their own (any other {username} resolves back to the caller).
- GET
{u}/memsearch-status/ — whether memsearch (enable_memsearch) is enabled for the org.
Writes
Agent memories
- POST
…/users/{username}/mentors/{mentor}/mentor-memories/ — add a memory:{
"category_slug": "string (required, must match an existing category slug)",
"content": "string (required, ≥10 chars)"
}
- PATCH
…/users/{username}/mentors/{mentor}/mentor-memories/{memoryId}/ — edit a memory (send at least one field):{
"category_slug": "string",
"content": "string (≥10 chars)"
}
- DELETE
…/users/{username}/mentors/{mentor}/mentor-memories/{memoryId}/ — delete one memory (no body). Destructive — confirm with the user first. Bulk delete = one call per memory.
Categories
- POST
…/orgs/{org}/mentors/{mentor}/memory-categories/ — add a category:{
"name": "string (required)",
"slug": "string (required, unique per agent)",
"description": "string",
"extraction_prompt": "string",
"is_active": "boolean (default true)"
}
- PATCH
…/orgs/{org}/mentors/{mentor}/memory-categories/{categoryId}/ — edit a category (any subset of the create fields).
- DELETE
…/orgs/{org}/mentors/{mentor}/memory-categories/{categoryId}/ — delete a category (no body). Destructive — confirm with the user first.
Agent knowledge (shared)
- POST
…/orgs/{org}/mentors/{mentor}/agent-memories/ — add a shared knowledge entry:{ "content": "string (required, ≥10 chars)" }
Dedups on a content hash: an identical entry returns 409 ({"error": "Memory already exists"}) rather than a duplicate; a new one returns 201 with the created object.
- PATCH
…/orgs/{org}/mentors/{mentor}/agent-memories/{memoryId}/ — replace an entry's content:{ "content": "string (required, ≥10 chars)" }
If the new content collides with another of the agent's entries, returns 409.
- DELETE
…/orgs/{org}/mentors/{mentor}/agent-memories/{memoryId}/ — delete one entry (no body, 204). Destructive — confirm with the user first.
Global (cross-agent) memories
- POST
{u}/global-memories/ — add a user-level memory: { "content": "string (required, ≥10 chars)" }.
- DELETE
{u}/global-memories/{memoryId}/ — delete one (no body). Destructive — confirm with the user first.
Settings
Example
List the first page of one agent's memories filed under the preferences category since the start of the year:
curl -s \
"https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mentors/$MENTOR/mentor-memories-list/?page=1&page_size=20&category=preferences&start_date=2026-01-01" \
-H "Authorization: Api-Token $IBLAI_API_KEY"
Notes
- Memories are filed under categories;
category_slug on an agent memory must match an
existing category's slug from the memory-categories/ endpoint.
- The
mentor-memories-list/ filters stack — combine category, user_id, email, and
the date range to narrow results; my_memory=true scopes the list to the caller's own memories.
- Global memories filter by
user_id / email plus session_id, content (substring),
and a start_date / end_date range — but not category or my_memory, which are
agent-memory-only (global memories aren't categorized).
- Categories are org- + agent-scoped (
…/orgs/{org}/mentors/{mentor}/…), not user-scoped
like the memory endpoints.
- Two things share the
agent-memories name. The user-scoped {u}/agent-memories/ (under
…/users/{username}) is the twin spelling of one user's per-agent memories; the org+agent-scoped
…/orgs/{org}/mentors/{mentor}/agent-memories/ (no user segment) is the shared agent knowledge
store. Different data, different path — pick by whether a users/{username} segment is present.
- There is no bulk-delete endpoint: to clear several memories, issue one DELETE per id.
- Flat list reads (global memories, agent memories, categories) return a DRF page
envelope —
{ "count": n, "results": [...] }; iterate results. The grouped
mentor-memories/ read instead buckets memories by category (see Reads). DELETEs return 204.
Schema
Memory object (every memory read returns this; UserMentorMemory / UserGlobalMemory):
| field |
mode |
notes |
id |
ro |
integer |
content |
req (write) |
the memory text; ≥10 chars |
username, email |
ro |
resolved from the user |
mentor_id |
ro |
agent memories only |
platform |
ro |
global memories only (org key) |
category |
ro |
agent memories only; nested category object |
source_session_id |
ro |
session the memory was extracted from, or null |
is_auto_generated |
ro |
true = LLM-extracted, false = added via API |
created_at, updated_at |
ro |
ISO 8601 |
Agent-knowledge object (MentorMemory; returned by the shared agent-memories endpoints):
| field |
mode |
notes |
id |
ro |
integer |
mentor_id |
ro |
the agent's unique id |
mentor_name |
ro |
the agent's name |
content |
req (write) |
the knowledge text; ≥10 chars |
created_by |
ro |
username of the curator, or null (service/API-key callers) |
created_at, updated_at |
ro |
ISO 8601 |
No category, is_auto_generated, or user fields — agent knowledge is shared and manually curated.
Category object (MentorMemoryCategory): id (ro), name, slug (unique per agent),
description, extraction_prompt, is_active (default true), created_at (ro).
Settings (memsearch-settings): auto_capture_enabled, use_memory_in_responses
(both boolean, default true), updated_at (ro).
Reference material
Background that complements the endpoints above (not required to call the API):
references/concepts.md — how extraction and injection actually behave (background capture, single-LLM-call, 3-layer dedup, top-5 semantic recall), the default categories, the org → agent → user enablement cascade, embedding/dedup specs, and a symptom→fix table.
1---2name: iblai-api-agent-memory3description: Manage an ibl.ai agent's memories via the platform API — list and filter agent memories (by category, user, email, date), curate global (cross-agent) memories, curate shared agent knowledge injected into every user's chat, add/edit/delete memories, manage memory categories, and toggle capture/recall settings. Use when inspecting or curating what an agent remembers.4---56# iblai-api-agent-memory78Manage an agent's memories through the API: browse and filter what an agent has9remembered, curate global (cross-agent) memories, add / edit / delete individual10memories, manage the categories memories are filed under, and control capture /11recall settings. Use when inspecting or curating what an agent remembers.1213## Auth & conventions1415- **Base URL:** `https://api.iblai.app`16- **Header:** `Authorization: Api-Token $IBLAI_API_KEY` on every request.17- **Path vars:** `{org}` = `$IBLAI_ORG`, `{username}` = `$IBLAI_USERNAME`,18 `{mentor}` = the agent's unique id (e.g. `d17dc729-60fd-4363-81a0-f67d9318b03e`).19- **Prefix / two spellings:** endpoints live under the `ai-mentor` base20 `https://api.iblai.app/dm/api/ai-mentor/orgs/{org}` (the leading `…` below). A twin21 `ai-agent` base mirrors every route with the `mentor` path token swapped for `agent`22 (`…/mentors/{mentor}/mentor-memories/` ↔ `…/agents/{agent}/agent-memories/`); either works.23- **Two path bases:** user-scoped routes hang off `…/orgs/{org}/users/{username}` (written24 `{u}` below); memory **categories** hang off `…/orgs/{org}/mentors/{mentor}` directly (no25 user segment).26- Not connected yet? Run **`/iblai-api-login`** first to populate `IBLAI_ORG`,27 `IBLAI_USERNAME`, and `IBLAI_API_KEY`.2829## Concepts3031Two PGVector-backed memory stores ("memsearch") sit behind these endpoints:3233- **Global memories** (`UserGlobalMemory`) — scoped to a user + org, shared across every34 agent; facts any agent should know about the user.35- **Agent memories** (`UserMentorMemory`) — scoped to a user + one agent + a36 **category**; what a single agent remembers about the user.37- **Agent knowledge** (`MentorMemory`) — scoped to one agent (org + agent), **not** any38 user and **not** categorized. Manually curated (never auto-extracted), it is injected into39 **every** user's chat with that agent as an `## Agent Knowledge` block, gated by the agent's40 `enable_memory_component` and each user's `use_memory_in_responses`. This is shared "how the41 agent should behave / what it should always know" content, distinct from the per-user stores42 above.4344**Categories** (`MentorMemoryCategory`, per agent) file agent memories and steer capture:45each has a `slug`, an `extraction_prompt` (LLM hint for what to pull into that category),46and `is_active` (whether it's used during extraction).4748**Capture & injection** are controlled per user via `memsearch-settings`:49- `auto_capture_enabled` — agents auto-extract memories from conversations. Auto-extracted50 rows carry `is_auto_generated: true`; memories you add via the API are `false`.51- `use_memory_in_responses` — stored memories are injected into agent responses.5253An org-wide `enable_memsearch` flag gates the whole feature (see `memsearch-status`).5455## Reads5657### Agent memories5859- **GET** `…/users/{username}/mentors/{mentor}/mentor-memories-list/?page={n}&page_size={n}&category={slug}&my_memory={bool}&user_id={id}&email={e}&start_date={yyyy-MM-dd}&end_date={yyyy-MM-dd}` — paged flat list for one agent.60- **GET** `…/users/{username}/mentors/{mentor}/mentor-memories/?my_memory={bool}&user_id={id}&email={e}&start_date=&end_date=` — the same memories grouped by category.61- **GET** `{u}/mentor-memories/?mentor={agent}&user_id={id}&email={e}&start_date=&end_date=` — the user's agent memories across **all** agents; add `?mentor=` to scope to one. Twin spelling: `{u}/agent-memories/`.6263### Categories6465- **GET** `…/orgs/{org}/mentors/{mentor}/memory-categories/` — category list for one agent.6667### Agent knowledge (shared)6869- **GET** `…/orgs/{org}/mentors/{mentor}/agent-memories/?page={n}&page_size={n}` — paged list of the agent's shared knowledge entries (DRF page envelope; `page_size` default 20, max 100). This path has **no** `users/{username}` segment — do not confuse it with the user-scoped `{u}/agent-memories/` twin spelling above, which lists one user's per-agent memories.7071### Global (cross-agent) memories7273- **GET** `{u}/global-memories/?user_id={id}&email={e}&session_id={uuid}&content={substr}&start_date={yyyy-MM-dd}&end_date={yyyy-MM-dd}` — user-level memories shared across every agent. Filters: `session_id` (the source session), `content` (case-insensitive substring), and the `start_date` / `end_date` created-at range.7475### Settings7677- **GET** `{u}/memsearch-settings/` — the user's capture / recall settings. Organization admins may read another user's settings by putting that user's username in the `{username}` path segment; non-admins are restricted to their own (any other `{username}` resolves back to the caller).78- **GET** `{u}/memsearch-status/` — whether memsearch (`enable_memsearch`) is enabled for the org.7980## Writes8182### Agent memories8384- **POST** `…/users/{username}/mentors/{mentor}/mentor-memories/` — add a memory:85 ```json86 {87 "category_slug": "string (required, must match an existing category slug)",88 "content": "string (required, ≥10 chars)"89 }90 ```91- **PATCH** `…/users/{username}/mentors/{mentor}/mentor-memories/{memoryId}/` — edit a memory (send at least one field):92 ```json93 {94 "category_slug": "string",95 "content": "string (≥10 chars)"96 }97 ```98- **DELETE** `…/users/{username}/mentors/{mentor}/mentor-memories/{memoryId}/` — delete one memory (no body). Destructive — confirm with the user first. Bulk delete = one call per memory.99100### Categories101102- **POST** `…/orgs/{org}/mentors/{mentor}/memory-categories/` — add a category:103 ```json104 {105 "name": "string (required)",106 "slug": "string (required, unique per agent)",107 "description": "string",108 "extraction_prompt": "string",109 "is_active": "boolean (default true)"110 }111 ```112- **PATCH** `…/orgs/{org}/mentors/{mentor}/memory-categories/{categoryId}/` — edit a category (any subset of the create fields).113- **DELETE** `…/orgs/{org}/mentors/{mentor}/memory-categories/{categoryId}/` — delete a category (no body). Destructive — confirm with the user first.114115### Agent knowledge (shared)116117- **POST** `…/orgs/{org}/mentors/{mentor}/agent-memories/` — add a shared knowledge entry:118 ```json119 { "content": "string (required, ≥10 chars)" }120 ```121 Dedups on a content hash: an identical entry returns `409` (`{"error": "Memory already exists"}`) rather than a duplicate; a new one returns `201` with the created object.122- **PATCH** `…/orgs/{org}/mentors/{mentor}/agent-memories/{memoryId}/` — replace an entry's content:123 ```json124 { "content": "string (required, ≥10 chars)" }125 ```126 If the new content collides with another of the agent's entries, returns `409`.127- **DELETE** `…/orgs/{org}/mentors/{mentor}/agent-memories/{memoryId}/` — delete one entry (no body, `204`). Destructive — confirm with the user first.128129### Global (cross-agent) memories130131- **POST** `{u}/global-memories/` — add a user-level memory: `{ "content": "string (required, ≥10 chars)" }`.132- **DELETE** `{u}/global-memories/{memoryId}/` — delete one (no body). Destructive — confirm with the user first.133134### Settings135136- **PUT** `{u}/memsearch-settings/` — update the user's capture / recall settings (send at least one field). Organization admins may update another user's settings by putting that user's username in the `{username}` path segment; non-admins are restricted to their own (any other `{username}` resolves back to the caller):137 ```json138 {139 "auto_capture_enabled": "boolean",140 "use_memory_in_responses": "boolean"141 }142 ```143144## Example145146List the first page of one agent's memories filed under the `preferences` category since the start of the year:147148```bash149curl -s \150 "https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mentors/$MENTOR/mentor-memories-list/?page=1&page_size=20&category=preferences&start_date=2026-01-01" \151 -H "Authorization: Api-Token $IBLAI_API_KEY"152```153154## Notes155156- Memories are filed under categories; `category_slug` on an agent memory must match an157 existing category's `slug` from the `memory-categories/` endpoint.158- The `mentor-memories-list/` filters stack — combine `category`, `user_id`, `email`, and159 the date range to narrow results; `my_memory=true` scopes the list to the caller's own memories.160- **Global memories** filter by `user_id` / `email` plus `session_id`, `content` (substring),161 and a `start_date` / `end_date` range — but **not** `category` or `my_memory`, which are162 agent-memory-only (global memories aren't categorized).163- Categories are org- + agent-scoped (`…/orgs/{org}/mentors/{mentor}/…`), not user-scoped164 like the memory endpoints.165- **Two things share the `agent-memories` name.** The user-scoped `{u}/agent-memories/` (under166 `…/users/{username}`) is the twin spelling of one user's per-agent memories; the org+agent-scoped167 `…/orgs/{org}/mentors/{mentor}/agent-memories/` (no user segment) is the **shared agent knowledge**168 store. Different data, different path — pick by whether a `users/{username}` segment is present.169- There is no bulk-delete endpoint: to clear several memories, issue one DELETE per id.170- Flat list reads (global memories, agent memories, categories) return a DRF page171 envelope — `{ "count": n, "results": [...] }`; iterate `results`. The grouped172 `mentor-memories/` read instead buckets memories by category (see Reads). DELETEs return `204`.173174## Schema175176**Memory object** (every memory read returns this; `UserMentorMemory` / `UserGlobalMemory`):177178| field | mode | notes |179| --- | --- | --- |180| `id` | ro | integer |181| `content` | req (write) | the memory text; ≥10 chars |182| `username`, `email` | ro | resolved from the user |183| `mentor_id` | ro | agent memories only |184| `platform` | ro | global memories only (org key) |185| `category` | ro | agent memories only; nested category object |186| `source_session_id` | ro | session the memory was extracted from, or null |187| `is_auto_generated` | ro | `true` = LLM-extracted, `false` = added via API |188| `created_at`, `updated_at` | ro | ISO 8601 |189190**Agent-knowledge object** (`MentorMemory`; returned by the shared `agent-memories` endpoints):191192| field | mode | notes |193| --- | --- | --- |194| `id` | ro | integer |195| `mentor_id` | ro | the agent's unique id |196| `mentor_name` | ro | the agent's name |197| `content` | req (write) | the knowledge text; ≥10 chars |198| `created_by` | ro | username of the curator, or `null` (service/API-key callers) |199| `created_at`, `updated_at` | ro | ISO 8601 |200201No `category`, `is_auto_generated`, or user fields — agent knowledge is shared and manually curated.202203**Category object** (`MentorMemoryCategory`): `id` (ro), `name`, `slug` (unique per agent),204`description`, `extraction_prompt`, `is_active` (default `true`), `created_at` (ro).205206**Settings** (`memsearch-settings`): `auto_capture_enabled`, `use_memory_in_responses`207(both boolean, default `true`), `updated_at` (ro).208209## Reference material210211Background that complements the endpoints above (not required to call the API):212213- [`references/concepts.md`](references/concepts.md) — how extraction and injection actually behave (background capture, single-LLM-call, 3-layer dedup, top-5 semantic recall), the default categories, the org → agent → user enablement cascade, embedding/dedup specs, and a symptom→fix table.