Skip to main content

Memory

The Memory Library stores facts, episodic notes, and learned context an agent can recall. Use this resource for full CRUD, semantic search, versioning, linking, and sharing of memories.

Access it as client.memory on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.

Quick start​

from strongly import Strongly

client = Strongly()

# List (auto-paginates as you iterate) # filters: kind, tags, search, linked_ids, as_of
for memory in client.memory.list():
print(memory.id)

Methods​

Core​

list​

list(*, kind: str | None = None, tags: list[str] | None = None, search: str | None = None, linked_ids: Sequence[str] | None = None, as_of: str | None = None, limit: int | None = None) -> SyncPaginator[MemorySummary]

List memories from the Memory Library with pagination and filters.

Parameters

  • kind (str | None, optional): Filter by kind (fact, episodic, semantic, instruction, preference).
  • tags (list[str] | None, optional): Filter by tags (matched against the memory's tag set).
  • search (str | None, optional): Full-text search over content, summary, and tags.
  • linked_ids (Sequence[str] | None, optional): Only memories that belong to all of these agents and pools.
  • as_of (str | None, optional): ISO-8601 timestamp for point-in-time recall.
  • limit (int | None, optional): Maximum number of items to return (default: all matching items).

Returns

  • SyncPaginator[MemorySummary]: A paginator yielding MemorySummary objects (retrieve for the full memory).

create​

create(*, kind: str, content: str, summary: str | None = None, tags: Sequence[str] | None = None, category: str | None = None, source: str | None = None, event_time: str | None = None, valid_from: str | None = None, valid_until: str | None = None, source_thread_id: str | None = None, source_message_id: str | None = None, source_tool_name: str | None = None, importance: float | None = None, decay_half_life_days: float | None = None, confidence: float | None = None, links: Sequence[Mapping[str, Any]] | None = None, linked_ids: Sequence[str] | None = None) -> Memory

Create a memory.

Parameters

  • kind (str): fact | episodic | semantic | instruction | preference (required).
  • content (str): Memory body (required).
  • summary (str | None, optional): Optional one-line summary.
  • tags (Sequence[str] | None, optional): Discoverability tags.
  • category (str | None, optional): Optional category label.
  • source (str | None, optional): Provenance label.
  • event_time (str | None, optional): ISO-8601 time the memory's event occurred (bitemporal).
  • valid_from (str | None, optional): ISO-8601 start of validity.
  • valid_until (str | None, optional): ISO-8601 end of validity (None = open-ended).
  • source_thread_id (str | None, optional): Originating thread id.
  • source_message_id (str | None, optional): Originating message id.
  • source_tool_name (str | None, optional): Originating tool name.
  • importance (float | None, optional): 0..1 retention weight.
  • decay_half_life_days (float | None, optional): Per-row decay half-life for ranking.
  • confidence (float | None, optional): 0..1 truth confidence.
  • links (Sequence[Mapping[str, Any]] | None, optional): Free-form initial graph links ({targetId, relation} rows).
  • linked_ids (Sequence[str] | None, optional): Agents and pools (ids) the memory belongs to.

Returns

  • MemoryModel: The created Memory.

retrieve​

retrieve(memory_id: str) -> Memory

Retrieve a single memory by id.

update​

update(memory_id: str, *, kind: str | None = None, content: str | None = None, summary: str | None = None, tags: Sequence[str] | None = None, category: str | None = None, event_time: str | None = None, valid_from: str | None = None, valid_until: str | None = None, source_thread_id: str | None = None, source_message_id: str | None = None, source_tool_name: str | None = None, importance: float | None = None, decay_half_life_days: float | None = None, confidence: float | None = None, links: Sequence[Mapping[str, Any]] | None = None, linked_ids: Sequence[str] | None = None, change_note: str | None = None) -> Memory

Update a memory and return the updated record.

Content changes append a new version. linked_ids replaces the agents and pools the memory belongs to. See create for the per-field semantics.

delete​

delete(memory_id: str) -> None

Delete a memory. Raises on failure; returns nothing.

Lifecycle & actions​

promote​

promote(memory_id: str) -> Memory

Put a memory in your organization's org-global pool, so every agent there reads it.

Other​

add_link(memory_id: str, *, target_id: str, relation: str, weight: float | None = None) -> MemoryLink

Create a directed link from this memory to another.

Parameters

  • memory_id (str): Source memory id.
  • target_id (str): Target memory id.
  • relation (str): supports | contradicts | refines | related.
  • weight (float | None, optional): Edge weight in [0, 1].

Returns

  • MemoryLink: The link now stored on the memory.

add_member​

add_member(resource_id: str, *, user_id: str, role: str) -> Permissions

Share the resource with a user.

Parameters

  • resource_id (str): The resource's id.
  • user_id (str): The user to share it with.
  • role (str): "editor" (use and change it) or "user" (use it only; types without a use-only tier, such as knowledge bases, take "editor" only).

assess​

assess(memory_id: str) -> LibraryAssessment

Get the memory's quality report: each check and what would raise the score.

The score itself (scoreResult) is kept on the memory by every change.

Returns the report: score (0-100) and grade over the checks that apply, weightAwarded / weightTotal, the failed critical and high counts, and checks. Each check has a status of pass, fail or skipped; a skipped check does not apply to this memory and is not part of the score.

consolidate​

consolidate(*, config: Mapping[str, Any] | None = None, dry_run: bool | None = None) -> MemoryConsolidation

Consolidate/deduplicate memories per the supplied policy.

Parameters

  • config (Mapping[str, Any] | None, optional): Free-form threshold overrides.
  • dry_run (bool | None, optional): Return the plan without applying changes.
delete_link(memory_id: str, target_id: str) -> None

Delete the link from memory_id to target_id.

demote​

demote(memory_id: str) -> Memory

Take a memory out of the org-global pool (undo promote).

export​

export(*, include_invalidated: bool | None = None) -> MemoryExport

Export every memory you can read as a portable bundle (import_memories reads it).

Parameters

  • include_invalidated (bool | None, optional): True also exports memories past their validity window.

import_memories​

import_memories(*, memories: Sequence[Mapping[str, Any]]) -> LibraryImportResult

Bulk-import memories from an export payload, as memories owned by the caller.

Parameters

  • memories (Sequence[Mapping[str, Any]]): Memory rows (the free-form shape export emits).

Returns

  • dict: imported (new memories), unchanged (rows the caller already has, same content), skipped (rows refused) and errors (index and message per skipped row).

ingest​

ingest(*, content: str, kind: str, agent_id: str, tags: Sequence[str] | None = None, linked_ids: Sequence[str] | None = None, candidate_k: int | None = None) -> MemoryIngestion

Ingest raw content for an agent: its model decides ADD/UPDATE/DELETE/NOOP and it is done.

Parameters

  • content (str): The new piece of information (required).
  • kind (str): fact | episodic | semantic | instruction | preference (required).
  • agent_id (str): The agent the memory is for (one you may use), required. Its configured model judges the memory through the AI Gateway, as the agent's call, and the memory joins the agent. An agent you may not use, or one with no model, is refused.
  • tags (Sequence[str] | None, optional): Tags for the new row (used only when the judge picks ADD).
  • linked_ids (Sequence[str] | None, optional): Further agents and pools (ids) a new memory belongs to, with the agent; the judge compares it with memories in them.
  • candidate_k (int | None, optional): How many similar memories to show the judge.

invalidate​

invalidate(memory_id: str, *, superseded_by: str | None = None) -> Memory

Mark a memory as invalidated (soft-retire without deleting).

Parameters

  • memory_id (str): Target memory id.
  • superseded_by (str | None, optional): Optional id of the memory that supersedes this one.

linked_to​

linked_to(memory_id: str, *, limit: int | None = None) -> SyncPaginator[MemorySummary]

List the memories that link to the given memory.

Parameters

  • memory_id (str): The memory's ID.
  • limit (int | None, optional): The most to return; all of them when omitted.

permissions​

permissions(resource_id: str) -> Permissions

Return who can reach the resource: its owner, members and their roles, and visibility.

Parameters

  • resource_id (str): The resource's id.

record_access​

record_access(memory_id: str) -> MemoryUsage

Record an access event against a memory (updates recency/usage).

remove_member​

remove_member(resource_id: str, user_id: str) -> None

Stop sharing the resource with a user.

Parameters

  • resource_id (str): The resource's id.
  • user_id (str): The user to stop sharing it with.

restore_version​

restore_version(memory_id: str, version: int) -> Memory

Restore a memory to an earlier version and return the restored record.

retrieve_version​

retrieve_version(memory_id: str, version: int) -> MemoryVersion

Retrieve a specific version snapshot of a memory.

search(*, query: str, limit: int | None = None, kind: str | None = None, tags: Sequence[str] | None = None, linked_ids: Sequence[str] | None = None, rrf_k: int | None = None, weights: Mapping[str, Any] | None = None, decay_half_life_days_override: float | None = None, as_of: str | None = None, include_invalidated: bool | None = None, rerank: bool | None = None, rerank_model: str | None = None) -> MemorySearchResults

Semantic/full-text (hybrid) search over the Memory Library.

Returns the raw search envelope ({results, count, contextBlock}); use list when you want typed, paginated results.

Parameters

  • query (str): Natural-language query (required).
  • limit (int | None, optional): The most memories to rank (default 10, at most 200).
  • kind (str | None, optional): Filter by memory kind.
  • tags (Sequence[str] | None, optional): Filter by tags (OR).
  • linked_ids (Sequence[str] | None, optional): Recall only from memories in any of these agents and pools.
  • rrf_k (int | None, optional): RRF k constant.
  • weights (Mapping[str, Any] | None, optional): Free-form per-list RRF weights ({vector?, text?}).
  • decay_half_life_days_override (float | None, optional): Override per-row decay for ranking.
  • as_of (str | None, optional): ISO-8601 point-in-time filter.
  • include_invalidated (bool | None, optional): Include rows past their validity window.
  • rerank (bool | None, optional): Rerank the fused results with a cross-encoder model. The search fails when no rerank model is given or configured.
  • rerank_model (str | None, optional): The rerank model; the memoryRerankModel setting when omitted.

set_visibility​

set_visibility(resource_id: str, visibility: str) -> Permissions

Make the resource public (every user can find and use it) or private.

Parameters

  • resource_id (str): The resource's id.
  • visibility (str): "public" or "private".

versions​

versions(memory_id: str, *, limit: int | None = None) -> SyncPaginator[MemoryVersion]

List the version history of a memory (most recent first).

Parameters

  • limit (int | None, optional): The most to return; all of them when omitted.