enterprise_ai.memory
Source: sdks/python/src/enterprise_ai/memory/__init__.py. Back to the Python SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class MemoryClient
/v1/memory.
Resource
MemoryClient.add_knowledge
add_knowledge(agent_id: str, texts: list[str], scope: str | None = None, team: str | None = None, dataset_id: str | None = None, classification: str | None = None, retention_days: int | None = None, legal_hold: bool | None = None, build_graph: bool | None = None) -> Any
Ingest knowledge. Adds texts to the Cognee dataset of one scope (Cognee POST /api/v1/add, then POST /api/v1/cognify when build_graph), only when the policy enables knowledge_graph and the engine is cognee or hybrid (else 403 or 422 memory_capability_unsupported). Same DLP, classification, retention and isolation checks as a memory; relation editor on the agent. 201 with dataset, items and graph. Accepts an Idempotency-Key header. Audited as memory.knowledge.create without the content.
Route: /v1/memory/agents/{agent_id}/knowledge (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
texts | list[str] | yes | One to 50 texts (each up to 100000 characters); secrets are refused. | |
scope | str | None | None | no | Isolation level of the dataset: agent (default), shared_agents, project, team, organization or global. |
team | str | None | None | no | Team of the team scope. |
dataset_id | str | None | None | no | Existing dataset of the same scope (Navin index id); default: the dataset of the scope, created when missing. |
classification | str | None | None | no | Declared classification of the texts. |
retention_days | int | None | None | no | Retention in days, within the limit of the policy. |
legal_hold | bool | None | None | no | Put the dataset under legal hold. Default false. |
build_graph | bool | None | None | no | Build the graph right after the ingestion (Cognee cognify). Default false. |
Returns: Any. Decoded JSON answer of the operation "Ingest knowledge".
Raises: the typed errors of the transport (Errors).
MemoryClient.agent_policy
agent_policy(agent_id: str) -> Any
Read the memory policy of an agent. Engine choice (builtin, mem0, cognee, hybrid), instances, modes, scopes, memorization limits, retention, sharing and required isolation of the agent, with version, configured (false: defaults, builtin engine) and engines (per purpose memory or knowledge: instance, provider, isolation and capabilities). Relation viewer on the agent, or the agent itself.
Route: /v1/memory/agents/{agent_id}/policy (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. |
Returns: Any. Decoded JSON answer of the operation "Read the memory policy of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.agent_policy_versions
agent_policy_versions(agent_id: str) -> Any
List the versions of the memory policy. Former versions of the memory policy of the agent, newest first (at most 200), each with its engine, instances, policy, author and date. Relation viewer on the agent.
Route: /v1/memory/agents/{agent_id}/policy/versions (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. |
Returns: Any. Decoded JSON answer of the operation "List the versions of the memory policy".
Raises: the typed errors of the transport (Errors).
MemoryClient.build_graph
build_graph(agent_id: str, dataset_ids: list[str] | None = None) -> Any
Build the knowledge graph. Runs Cognee POST /api/v1/cognify on readable datasets of the instance of the agent (all of them by default). Relation editor on the agent. Audited as memory.knowledge.build.
Route: /v1/memory/agents/{agent_id}/knowledge/graph (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
dataset_ids | list[str] | None | None | no | Navin index ids of the datasets (default: every readable dataset). |
Returns: Any. Decoded JSON answer of the operation "Build the knowledge graph".
Raises: the typed errors of the transport (Errors).
MemoryClient.datasets
datasets(agent_id: str, scope: str | None = None, limit: int | None = None, cursor: str | None = None) -> Any
List the knowledge datasets. Datasets the caller may read through this agent, paginated with cursor.
Route: /v1/memory/agents/{agent_id}/knowledge/datasets (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
scope | str | None | None | no | Only this isolation level: agent, shared_agents, project, team, organization or global. |
limit | int | None | None | no | Maximum number of items in one page. The server caps the value; read the next page with cursor. |
cursor | str | None | None | no | Opaque cursor returned as next_cursor by the previous page. Omit it to read the first page. |
Returns: Any. Decoded JSON answer of the operation "List the knowledge datasets".
Raises: the typed errors of the transport (Errors).
MemoryClient.declare_engine
declare_engine(id: str, provider: str, base_url: str, tenant_id: str | None = None, credential_ref: str | None = None, access_control: bool | None = None, tls_verify: bool | None = None, timeout_seconds: float | None = None, manager_cluster: str | None = None, manager_service: str | None = None) -> Any
Declare a memory engine instance. Declares an instance of Mem0 or Cognee installed and operated by the Navin Manager, for example one dedicated to a tenant (tenant_id: physical separation, as a bank requires). Only platform_admin (403 otherwise). The credential is a reference only (openbao://<path> or env://EAI_CRED_<NAME>), resolved server side. 409 conflict when the id exists or is reserved (builtin, mem0, cognee), 404 for an unknown tenant. Accepts an Idempotency-Key header. Audited as memory.engine.declare.
Route: /v1/memory/engines (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | str | yes | Identifier (lowercase letters, digits and dashes, 2 to 63 characters). | |
provider | str | yes | mem0 or cognee. | |
base_url | str | yes | Address of the API rendered by the Navin Manager (https in staging and prod). | |
tenant_id | str | None | None | no | Tenant the instance is dedicated to; empty: shared instance. |
credential_ref | str | None | None | no | Reference to the API key: openbao://<path> or env://EAI_CRED_<NAME>. |
access_control | bool | None | None | no | Cognee only: the instance runs with backend access control (one user per tenant gives a backend separation). |
tls_verify | bool | None | None | no | Verify the certificate of the engine (default true; the Manager CA of EAI_MEMORY_ENGINES_CA_FILE is trusted). |
timeout_seconds | float | None | None | no | Timeout of one call in seconds (default 10, at most 300). |
manager_cluster | str | None | None | no | Cluster of the Navin Manager that operates the instance (information). |
manager_service | str | None | None | no | Service of the Navin Manager catalog (information). |
Returns: Any. Decoded JSON answer of the operation "Declare a memory engine instance".
Raises: the typed errors of the transport (Errors).
MemoryClient.delete
delete(memory_id: str) -> Any
Delete a memory item. Erases the content, the reference, the vector and the former versions of the item and marks it deleted. Allowed for a writer or owner of the item, or tenant_admin (else 403 not_permitted_acl). An item under legal hold answers 409 legal_hold (the refusal is audited); a non deletable item answers 409 conflict unless the caller is tenant_admin. 404 not_found. Audited as memory.delete.
Route: /v1/memory/{memory_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
memory_id | str | yes | Identifier (UUID) of the memory item. |
Returns: Any. Decoded JSON answer of the operation "Delete a memory item".
Raises: the typed errors of the transport (Errors).
MemoryClient.delete_dataset
delete_dataset(agent_id: str, dataset_id: str) -> Any
Delete a knowledge dataset. Deletes the dataset in Cognee (DELETE /api/v1/datasets/{dataset_id}) and its index entries. 409 legal_hold when the dataset or one of its items is held. Audited as memory.knowledge.delete.
Route: /v1/memory/agents/{agent_id}/knowledge/datasets/{dataset_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
dataset_id | str | yes | Identifier (UUID) of the Navin index entry of the dataset. |
Returns: Any. Decoded JSON answer of the operation "Delete a knowledge dataset".
Raises: the typed errors of the transport (Errors).
MemoryClient.delete_engine
delete_engine(engine_id: str) -> Any
Remove a declared memory engine instance. Removes a declared instance and the tenant credentials bound to it. Only platform_admin. 409 memory_engine_in_use while an agent policy or a memory still uses it; 404 memory_engine_not_found. Audited as memory.engine.delete.
Route: /v1/memory/engines/{engine_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
engine_id | str | yes | Identifier of the engine instance. |
Returns: Any. Decoded JSON answer of the operation "Remove a declared memory engine instance".
Raises: the typed errors of the transport (Errors).
MemoryClient.delete_engine_credential
delete_engine_credential(engine_id: str) -> Any
Unbind the credential of the tenant. Removes the credential of this tenant on the instance; the credential of the instance is used again. Role tenant_admin. Audited as memory.engine.change.
Route: /v1/memory/engines/{engine_id}/credential (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
engine_id | str | yes | Identifier of the engine instance. |
Returns: Any. Decoded JSON answer of the operation "Unbind the credential of the tenant".
Raises: the typed errors of the transport (Errors).
MemoryClient.engine_capabilities
engine_capabilities(engine_id: str) -> Any
Read the capabilities of a memory engine. Declarative capability set of the engine: only what its provider really executes. memory: among remember, recall, search, update, forget, list, get, purge, get_health, get_capabilities; knowledge: among ingest_knowledge, build_graph, search_graph, get_relations, delete_dataset. An operation outside this set answers 422 memory_capability_unsupported. Also gives isolation for the tenant and session_memory (true for builtin only: session memory never goes to an external engine). Nothing is sent to the engine.
Route: /v1/memory/engines/{engine_id}/capabilities (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
engine_id | str | yes | Identifier of the engine instance (builtin, mem0, cognee or a declared id). |
Returns: Any. Decoded JSON answer of the operation "Read the capabilities of a memory engine".
Raises: the typed errors of the transport (Errors).
MemoryClient.engine_health
engine_health(engine_id: str) -> Any
Check the health of a memory engine. Calls the engine with the credential of the tenant: Mem0 GET /auth/setup-status then GET /configure/providers, Cognee GET /health then GET /api/v1/datasets. Answers status up (or degraded), or down with error and reason (never a secret). Roles tenant_admin, developer, security_officer or auditor.
Route: /v1/memory/engines/{engine_id}/health (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
engine_id | str | yes | Identifier of the engine instance. |
Returns: Any. Decoded JSON answer of the operation "Check the health of a memory engine".
Raises: the typed errors of the transport (Errors).
MemoryClient.engines
engines() -> Any
List the memory engines. Memory engines the tenant may use (Navin Memory Provider): builtin (the Memory Manager store), the platform instances mem0 and cognee rendered by the Navin Manager from its bindings (only when configured), and the instances declared by the platform administrator (shared ones and those dedicated to this tenant; a dedicated instance of another tenant is never listed). Each entry gives provider, base_url, origin (builtin, manager_binding, declared), dedicated, credential_bound (the credential itself is never returned), isolation (logical, backend or dedicated_instance: the separation this instance guarantees for the tenant) and capabilities. Navin Enterprise never installs nor configures an engine: the Navin Manager does.
Route: /v1/memory/engines (GET).
This element takes no parameter.
Returns: Any. Decoded JSON answer of the operation "List the memory engines".
Raises: the typed errors of the transport (Errors).
MemoryClient.export
export(agent_id: str, scopes: list[str] | None = None) -> Any
Export the memories of an agent. Exports at most 1000 readable memories with their content (untrusted data). Refused to agents (403). Audited as memory.export without the content.
Route: /v1/memory/agents/{agent_id}/memories/export (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
scopes | list[str] | None | None | no | Isolation levels to export (default: every readable scope). |
Returns: Any. Decoded JSON answer of the operation "Export the memories of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.forget
forget(agent_id: str, item_id: str) -> Any
Forget a memory of an agent. Deletes the memory in its engine (Mem0 DELETE /memories/{memory_id}, Cognee data item deletion, builtin soft delete) and marks the index entry deleted. 409 legal_hold; only the owner agent of a shared memory (403). Audited as memory.provider.delete.
Route: /v1/memory/agents/{agent_id}/memories/{item_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
item_id | str | yes | Identifier (UUID) of the Navin index entry. |
Returns: Any. Decoded JSON answer of the operation "Forget a memory of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.get
get(memory_id: str) -> Any
Get a memory item. Returns the item as a Memory Contract document with its history (former version numbers and dates). An expired item, or one the caller may not read by ACL or clearance, answers 404 not_found.
Route: /v1/memory/{memory_id} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
memory_id | str | yes | Identifier (UUID) of the memory item. |
Returns: Any. Decoded JSON answer of the operation "Get a memory item".
Raises: the typed errors of the transport (Errors).
MemoryClient.list
list(scope_type: str | None = None, scope_id: str | None = None, kind: str | None = None, **page: Any) -> Any
List the memory items. Items the caller may read (listed in readers, classification within its clearance, not expired, not deleted), as Memory Contract documents, paginated with cursor.
Route: /v1/memory (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
scope_type | str | None | None | no | Only this scope type: session, agent, user, project or tenant. |
scope_id | str | None | None | no | Only this scope id. |
kind | str | None | None | no | Only this kind: episodic, semantic, procedural, preference or fact. |
**page | Any | no | Pagination options passed to the listing: limit (maximum number of items per page) and cursor (the next_cursor of the previous page). Iterating the returned page follows every cursor. |
Returns: Any. Decoded JSON answer of the operation "List the memory items".
Raises: the typed errors of the transport (Errors).
MemoryClient.memories
memories(agent_id: str, scope: str | None = None, include_content: bool | None = None, limit: int | None = None, cursor: str | None = None) -> Any
List the memories of an agent. Index entries of the memories the caller may read through this agent (readable scopes of the policy, classification within the clearance, not expired), paginated with cursor. With include_content=true (at most 100 per page) the content is read from the engine and returned as untrusted data. Audited as memory.provider.read.
Route: /v1/memory/agents/{agent_id}/memories (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
scope | str | None | None | no | Only this isolation level: session, user, agent, shared_agents, project, team, organization or global. |
include_content | bool | None | None | no | Also read the content from the engine (default false). |
limit | int | None | None | no | Maximum number of items in one page. The server caps the value; read the next page with cursor. |
cursor | str | None | None | no | Opaque cursor returned as next_cursor by the previous page. Omit it to read the first page. |
Returns: Any. Decoded JSON answer of the operation "List the memories of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.memory_item
memory_item(agent_id: str, item_id: str) -> Any
Get a memory of an agent. Index entry and content (read from the engine, untrusted data) of one memory. An item of a scope the caller may not read answers 404, never 403, so its existence is not disclosed. Audited as memory.provider.read.
Route: /v1/memory/agents/{agent_id}/memories/{item_id} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
item_id | str | yes | Identifier (UUID) of the Navin index entry. |
Returns: Any. Decoded JSON answer of the operation "Get a memory of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.purge
purge(agent_id: str, scope: str, confirm: bool, team: str | None = None, session_id: str | None = None) -> Any
Purge one scope of an agent. Deletes every memory and dataset of one scope of the caller (Mem0 DELETE /memories with the identifiers of the scope, Cognee dataset deletion, builtin soft delete). confirm must be true (400). 409 legal_hold when an item of the scope is held. Audited as memory.provider.purge.
Route: /v1/memory/agents/{agent_id}/memories/purge (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
scope | str | yes | Isolation level to purge. | |
confirm | bool | yes | Must be true. | |
team | str | None | None | no | Team of the team scope. |
session_id | str | None | None | no | Session of the session scope. |
Returns: Any. Decoded JSON answer of the operation "Purge one scope of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.recall
recall(agent_id: str, query: str, scopes: list[str] | None = None, top_k: int | None = None, session_id: str | None = None) -> Any
Recall memories for the LLM. Searches the readable scopes on the engines of the policy (hybrid: Mem0 and Cognee, merged and deduplicated by content, every source kept in sources), keeps only the results indexed by Navin for a readable scope and within the clearance (permission check before anything reaches the LLM), screens them for prompt injection (blocked items dropped) and returns them as untrusted data: framed_content wrapped in the untrusted markers and context_segments of type memory for the Context Manager, never instructions. The policy decision memory.search is evaluated. Audited as memory.provider.read with counts only.
Route: /v1/memory/agents/{agent_id}/recall (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
query | str | yes | Text of the query (1 to 4000 characters). | |
scopes | list[str] | None | None | no | Isolation levels to search (default: the readable scopes of the policy). |
top_k | int | None | None | no | Number of results (1 to 50, default recall_top_k of the policy). |
session_id | str | None | None | no | Session of the caller, to include its session memory. |
Returns: Any. Decoded JSON answer of the operation "Recall memories for the LLM".
Raises: the typed errors of the transport (Errors).
MemoryClient.relations
relations(agent_id: str, dataset_id: str) -> Any
Read the relations of a dataset. Nodes and edges of the knowledge graph of one readable dataset (Cognee GET /api/v1/datasets/{dataset_id}/graph), screened for prompt injection and returned as untrusted data. 404 for a dataset the caller may not read. Audited as memory.provider.read.
Route: /v1/memory/agents/{agent_id}/knowledge/datasets/{dataset_id}/relations (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
dataset_id | str | yes | Identifier (UUID) of the Navin index entry of the dataset. |
Returns: Any. Decoded JSON answer of the operation "Read the relations of a dataset".
Raises: the typed errors of the transport (Errors).
MemoryClient.remember
remember(agent_id: str, content: str, scope: str | None = None, kind: str | None = None, classification: str | None = None, session_id: str | None = None, team: str | None = None, retention_days: int | None = None, legal_hold: bool | None = None, source: dict[str, Any] | None = None) -> Any
Remember through the engine of the agent. Writes one memory through the engine of the agent policy (session scope: always the builtin store; hybrid: Mem0). 201 with items (index entries, without content), engine and engine_instance. The context (tenant, organization, project, user, agent, session) is derived server side from the authenticated principal, the agent registry and the verified session, never from the body. Checks, each refusal audited: an agent only uses its own memory (403 memory_agent_mismatch), the scope and the kind must be allowed by the policy (403), shared scopes need editor on the agent, the engine must announce remember (422 memory_capability_unsupported) and guarantee the required isolation (409), secrets, passwords, tokens and keys are refused (422 memory_secret_refused), personal data when the policy forbids it (422), a classification above the policy or the clearance (403), a retention above the policy (422). Accepts an Idempotency-Key header. Audited as memory.provider.create without the content.
Route: /v1/memory/agents/{agent_id}/memories (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
content | str | yes | Text to remember (1 to 20000 characters); secrets are refused. | |
scope | str | None | None | no | Isolation level: session, user, agent, shared_agents, project, team, organization or global. Default: default_scope of the policy. |
kind | str | None | None | no | episodic, semantic, procedural, preference or fact (default). |
classification | str | None | None | no | Declared classification; raised by the detection, refused above the policy or the clearance. |
session_id | str | None | None | no | Session of the caller (required for the session scope; verified server side). |
team | str | None | None | no | Team of the policy for the team scope (default: its first team). |
retention_days | int | None | None | no | Retention in days, within the limit of the policy. |
legal_hold | bool | None | None | no | Put the memory under legal hold. Default false. |
source | dict[str, Any] | None | None | no | Provenance of the content. |
Returns: Any. Decoded JSON answer of the operation "Remember through the engine of the agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.restore_agent_policy
restore_agent_policy(agent_id: str, version: int) -> Any
Restore a version of the memory policy. Applies a former version again as a new version, with the same checks as PUT .../policy. 404 for an unknown version. Audited as memory.policy.restore.
Route: /v1/memory/agents/{agent_id}/policy/restore (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
version | int | yes | Version number (1 or more). |
Returns: Any. Decoded JSON answer of the operation "Restore a version of the memory policy".
Raises: the typed errors of the transport (Errors).
MemoryClient.search
search(query: str, top_k: int = 5, **filters: Any) -> Any
Search the memory. Scores the visible items (at most the 2000 most recently updated ones with content) and returns the best top_k with score, keyword_score and vector_score. keyword: share of query terms found; vector: cosine similarity with the query embedding (only items embedded with the current model); hybrid (default): half of each. Recalled content is screened for prompt injection; blocked items are dropped. The policy memory.search is evaluated. 400 invalid_request for an unknown mode. Audited as memory.search.
Route: /v1/memory/search (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
query | str | yes | Text of the query (at least 1 character). | |
top_k | int | 5 | no | Number of results (1 to 100, default 10). |
**filters | Any | no | Extra body fields of the search, such as scope, kind or mode (default hybrid). |
Returns: Any. Decoded JSON answer of the operation "Search the memory".
Raises: the typed errors of the transport (Errors).
MemoryClient.search_knowledge
search_knowledge(agent_id: str, query: str, dataset_ids: list[str] | None = None, top_k: int | None = None, search_type: str | None = None) -> Any
Search the knowledge graph. Cognee POST /api/v1/search, one readable dataset per call so every passage is attributed to its dataset; results are screened and returned as untrusted data with framed_content. The policy decision memory.search is evaluated. Audited as memory.provider.read.
Route: /v1/memory/agents/{agent_id}/knowledge/search (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
query | str | yes | Text of the query (1 to 4000 characters). | |
dataset_ids | list[str] | None | None | no | Navin index ids of the datasets (default: every readable dataset). |
top_k | int | None | None | no | Number of results (1 to 50, default 10). |
search_type | str | None | None | no | Cognee search type: CHUNKS (default), CHUNKS_LEXICAL, SUMMARIES, RAG_COMPLETION or GRAPH_COMPLETION. |
Returns: Any. Decoded JSON answer of the operation "Search the knowledge graph".
Raises: the typed errors of the transport (Errors).
MemoryClient.search_memories
search_memories(agent_id: str, query: str, scopes: list[str] | None = None, top_k: int | None = None, session_id: str | None = None) -> Any
Search the memories of an agent. Same search as recall for a person who consults the memories (no context_segments); shared scopes need editor on the agent. Results are untrusted data. Audited as memory.provider.read.
Route: /v1/memory/agents/{agent_id}/memories/search (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
query | str | yes | Text of the query (1 to 4000 characters). | |
scopes | list[str] | None | None | no | Isolation levels to search (default: the readable scopes of the policy). |
top_k | int | None | None | no | Number of results (1 to 50, default recall_top_k of the policy). |
session_id | str | None | None | no | Session of the caller, to include its session memory. |
Returns: Any. Decoded JSON answer of the operation "Search the memories of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.set_agent_policy
set_agent_policy(agent_id: str, engine: str = 'builtin', mem0_instance: str | None = None, cognee_instance: str | None = None, policy: dict[str, Any] | None = None) -> Any
Set the memory policy of an agent. Replaces the memory policy of the agent (new version, the former one is kept for a restore). Checks: roles tenant_admin, developer or application_owner and relation editor on the agent (403); global_access needs tenant_admin; default_scope must be a write scope and shared_with existing agents (400); the chosen instances must exist, match the provider and guarantee required_isolation (409 memory_isolation_unsatisfied: a dedicated instance installed by the Navin Manager is required). The policy decision memory.policy.update is enforced. shared_with writes or deletes the OpenFGA relation memory_reader of each agent on this one. Audited as memory.policy.update, plus memory.engine.change when the engine or an instance changes and memory.share when the sharing changes.
Route: /v1/memory/agents/{agent_id}/policy (PUT).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
engine | str | 'builtin' | no | builtin (default, Memory Manager store), mem0 (persistent facts and memories), cognee (knowledge and relations) or hybrid (memories in Mem0, knowledge in Cognee, merged at recall). Session memory always stays builtin. |
mem0_instance | str | None | None | no | Mem0 instance to use (default mem0, the platform instance of the Navin Manager), for example a dedicated one. |
cognee_instance | str | None | None | no | Cognee instance to use (default cognee). |
policy | dict[str, Any] | None | None | no | Modes, scopes, memorization limits, retention, sharing and required isolation. |
Returns: Any. Decoded JSON answer of the operation "Set the memory policy of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.set_engine_credential
set_engine_credential(engine_id: str, credential_ref: str) -> Any
Bind the credential of the tenant on an engine. Binds the credential of this tenant on a shared instance (openbao://<path> reference to a secret of the tenant). On a Cognee instance with backend access control, it is the API key of the Cognee user of the tenant: its datasets and permissions are then enforced by Cognee itself (isolation becomes backend). On Mem0 a key does not separate the memories (logical stays). Role tenant_admin. Audited as memory.engine.change.
Route: /v1/memory/engines/{engine_id}/credential (PUT).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
engine_id | str | yes | Identifier of the engine instance. | |
credential_ref | str | yes | Reference openbao://<path> to a secret of the tenant. |
Returns: Any. Decoded JSON answer of the operation "Bind the credential of the tenant on an engine".
Raises: the typed errors of the transport (Errors).
MemoryClient.update_memory
update_memory(agent_id: str, item_id: str, content: str) -> Any
Update a memory of an agent. Replaces the content of a memory in its engine (Mem0 PUT /memories/{memory_id}, builtin new version) after the same DLP checks as a creation; the version increases. Only the owner agent of a shared memory may change it (403); a held item answers 409 legal_hold. Audited as memory.provider.update.
Route: /v1/memory/agents/{agent_id}/memories/{item_id} (PATCH).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
agent_id | str | yes | Name or identifier of the agent. | |
item_id | str | yes | Identifier (UUID) of the Navin index entry. | |
content | str | yes | Text (1 to 20000 characters); secrets are refused. |
Returns: Any. Decoded JSON answer of the operation "Update a memory of an agent".
Raises: the typed errors of the transport (Errors).
MemoryClient.write
write(content: str, scope: Scope | null = None, subject_id: str | None = None, kind: str | None = None, classification: str = 'internal', ttl_seconds: int | None = None, **extra: Any) -> Any
Write a memory item. Creates an item, or a new version of memory_id (201, Memory Contract document). Steps: 1. kind and scope.type are checked (400 invalid_request); content or content_ref is required. 2. Personal data detection may raise the classification; a classification above the caller clearance answers 403 policy_denied; the policy memory.write is evaluated. 3. For an update, the caller must be a writer or owner (403 not_permitted_acl) before the content is sent to the embedding model. 4. The content is embedded and stored. A new item defaults to the caller as reader, writer and owner, and to the user scope of the caller. Audited as memory.create or memory.update.
Route: /v1/memory (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
content | str | yes | Text to remember; embedded for vector search. | |
scope | Scope | null | None | no | Scope of a new item. Default: {type: user, id: <caller>}. |
subject_id | str | None | None | no | Data subject the item is about (used by privacy requests). Default: the scope id for a user scope, else the caller. |
kind | str | None | None | no | episodic, semantic, procedural, preference or fact (default). |
classification | str | 'internal' | no | public, internal (default), confidential, restricted or secret; raised when personal data is detected, and never above the caller clearance. |
ttl_seconds | int | None | None | no | Lifetime in seconds (0 or more); after it the item is no longer returned. Omitted: no expiry. |
**extra | Any | no | Extra fields merged into the request body. |
Returns: Any. Decoded JSON answer of the operation "Write a memory item".
Raises: the typed errors of the transport (Errors).