Skip to main content

enterprise_ai.memory

Source: sdks/python/src/enterprise_ai/memory/__init__.py. Back to the Python SDK reference index.

note

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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
textslist[str]yesOne to 50 texts (each up to 100000 characters); secrets are refused.
scopestr | NoneNonenoIsolation level of the dataset: agent (default), shared_agents, project, team, organization or global.
teamstr | NoneNonenoTeam of the team scope.
dataset_idstr | NoneNonenoExisting dataset of the same scope (Navin index id); default: the dataset of the scope, created when missing.
classificationstr | NoneNonenoDeclared classification of the texts.
retention_daysint | NoneNonenoRetention in days, within the limit of the policy.
legal_holdbool | NoneNonenoPut the dataset under legal hold. Default false.
build_graphbool | NoneNonenoBuild 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).

NameTypeDefaultRequiredDescription
agent_idstryesName 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).

NameTypeDefaultRequiredDescription
agent_idstryesName 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
dataset_idslist[str] | NoneNonenoNavin 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
scopestr | NoneNonenoOnly this isolation level: agent, shared_agents, project, team, organization or global.
limitint | NoneNonenoMaximum number of items in one page. The server caps the value; read the next page with cursor.
cursorstr | NoneNonenoOpaque 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).

NameTypeDefaultRequiredDescription
idstryesIdentifier (lowercase letters, digits and dashes, 2 to 63 characters).
providerstryesmem0 or cognee.
base_urlstryesAddress of the API rendered by the Navin Manager (https in staging and prod).
tenant_idstr | NoneNonenoTenant the instance is dedicated to; empty: shared instance.
credential_refstr | NoneNonenoReference to the API key: openbao://<path> or env://EAI_CRED_<NAME>.
access_controlbool | NoneNonenoCognee only: the instance runs with backend access control (one user per tenant gives a backend separation).
tls_verifybool | NoneNonenoVerify the certificate of the engine (default true; the Manager CA of EAI_MEMORY_ENGINES_CA_FILE is trusted).
timeout_secondsfloat | NoneNonenoTimeout of one call in seconds (default 10, at most 300).
manager_clusterstr | NoneNonenoCluster of the Navin Manager that operates the instance (information).
manager_servicestr | NoneNonenoService 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).

NameTypeDefaultRequiredDescription
memory_idstryesIdentifier (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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
dataset_idstryesIdentifier (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).

NameTypeDefaultRequiredDescription
engine_idstryesIdentifier 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).

NameTypeDefaultRequiredDescription
engine_idstryesIdentifier 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).

NameTypeDefaultRequiredDescription
engine_idstryesIdentifier 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).

NameTypeDefaultRequiredDescription
engine_idstryesIdentifier 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
scopeslist[str] | NoneNonenoIsolation 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
item_idstryesIdentifier (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).

NameTypeDefaultRequiredDescription
memory_idstryesIdentifier (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).

NameTypeDefaultRequiredDescription
scope_typestr | NoneNonenoOnly this scope type: session, agent, user, project or tenant.
scope_idstr | NoneNonenoOnly this scope id.
kindstr | NoneNonenoOnly this kind: episodic, semantic, procedural, preference or fact.
**pageAnynoPagination 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
scopestr | NoneNonenoOnly this isolation level: session, user, agent, shared_agents, project, team, organization or global.
include_contentbool | NoneNonenoAlso read the content from the engine (default false).
limitint | NoneNonenoMaximum number of items in one page. The server caps the value; read the next page with cursor.
cursorstr | NoneNonenoOpaque 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
item_idstryesIdentifier (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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
scopestryesIsolation level to purge.
confirmboolyesMust be true.
teamstr | NoneNonenoTeam of the team scope.
session_idstr | NoneNonenoSession 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
querystryesText of the query (1 to 4000 characters).
scopeslist[str] | NoneNonenoIsolation levels to search (default: the readable scopes of the policy).
top_kint | NoneNonenoNumber of results (1 to 50, default recall_top_k of the policy).
session_idstr | NoneNonenoSession 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
dataset_idstryesIdentifier (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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
contentstryesText to remember (1 to 20000 characters); secrets are refused.
scopestr | NoneNonenoIsolation level: session, user, agent, shared_agents, project, team, organization or global. Default: default_scope of the policy.
kindstr | NoneNonenoepisodic, semantic, procedural, preference or fact (default).
classificationstr | NoneNonenoDeclared classification; raised by the detection, refused above the policy or the clearance.
session_idstr | NoneNonenoSession of the caller (required for the session scope; verified server side).
teamstr | NoneNonenoTeam of the policy for the team scope (default: its first team).
retention_daysint | NoneNonenoRetention in days, within the limit of the policy.
legal_holdbool | NoneNonenoPut the memory under legal hold. Default false.
sourcedict[str, Any] | NoneNonenoProvenance 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
versionintyesVersion 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).

NameTypeDefaultRequiredDescription
querystryesText of the query (at least 1 character).
top_kint5noNumber of results (1 to 100, default 10).
**filtersAnynoExtra 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
querystryesText of the query (1 to 4000 characters).
dataset_idslist[str] | NoneNonenoNavin index ids of the datasets (default: every readable dataset).
top_kint | NoneNonenoNumber of results (1 to 50, default 10).
search_typestr | NoneNonenoCognee 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
querystryesText of the query (1 to 4000 characters).
scopeslist[str] | NoneNonenoIsolation levels to search (default: the readable scopes of the policy).
top_kint | NoneNonenoNumber of results (1 to 50, default recall_top_k of the policy).
session_idstr | NoneNonenoSession 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
enginestr'builtin'nobuiltin (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_instancestr | NoneNonenoMem0 instance to use (default mem0, the platform instance of the Navin Manager), for example a dedicated one.
cognee_instancestr | NoneNonenoCognee instance to use (default cognee).
policydict[str, Any] | NoneNonenoModes, 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).

NameTypeDefaultRequiredDescription
engine_idstryesIdentifier of the engine instance.
credential_refstryesReference 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).

NameTypeDefaultRequiredDescription
agent_idstryesName or identifier of the agent.
item_idstryesIdentifier (UUID) of the Navin index entry.
contentstryesText (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).

NameTypeDefaultRequiredDescription
contentstryesText to remember; embedded for vector search.
scopeScope | nullNonenoScope of a new item. Default: {type: user, id: <caller>}.
subject_idstr | NoneNonenoData subject the item is about (used by privacy requests). Default: the scope id for a user scope, else the caller.
kindstr | NoneNonenoepisodic, semantic, procedural, preference or fact (default).
classificationstr'internal'nopublic, internal (default), confidential, restricted or secret; raised when personal data is detected, and never above the caller clearance.
ttl_secondsint | NoneNonenoLifetime in seconds (0 or more); after it the item is no longer returned. Omitted: no expiry.
**extraAnynoExtra 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).