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, agent_id, app_id, workflow_id, as_of
for memory in client.memory.list():
print(memory.id)
# Create
created = client.memory.create(
kind="...",
content="...",
)
print(created.id)
# Read it back
fetched = client.memory.retrieve(created.id)
# Delete (returns None; raises on failure)
client.memory.delete(created.id)
Methods
Core
list
list(*, kind: Optional[str] = None, tags: Optional[List[str]] = None, search: Optional[str] = None, agent_id: Optional[str] = None, app_id: Optional[str] = None, workflow_id: Optional[str] = None, as_of: Optional[str] = None, limit: Optional[int] = None) -> SyncPaginator[Memory]
List memories from the Memory Library with pagination and filters.
Args:
kind: Filter by kind (fact, episodic, semantic,
instruction, preference).
tags: Filter by tags (matched against the memory's tag set).
search: Full-text search over content, summary, and tags.
agent_id: Restrict to memories scoped to this agent.
app_id: Restrict to memories scoped to this app instance.
workflow_id: Restrict to memories scoped to this workflow.
as_of: ISO-8601 timestamp for point-in-time recall.
limit: Maximum number of items to return (default: all matching items).
Returns:
A paginator yielding Memory objects.
create
create(*, kind: str, content: str, summary: Optional[str] = None, tags: Optional[Sequence[str]] = None, category: Optional[str] = None, source: Optional[str] = None, event_time: Optional[str] = None, valid_from: Optional[str] = None, valid_until: Optional[str] = None, source_thread_id: Optional[str] = None, source_message_id: Optional[str] = None, source_tool_name: Optional[str] = None, importance: Optional[float] = None, decay_half_life_days: Optional[float] = None, confidence: Optional[float] = None, links: Optional[Sequence[Mapping[str, Any]]] = None, scope: Optional[Mapping[str, Any]] = None) -> Memory
Create a memory.
Args:
kind: fact | episodic | semantic | instruction |
preference (required).
content: Memory body (required).
summary: Optional one-line summary.
tags: Discoverability tags.
category: Optional category label.
source: Provenance label.
event_time: ISO-8601 time the memory's event occurred (bitemporal).
valid_from: ISO-8601 start of validity.
valid_until: ISO-8601 end of validity (None = open-ended).
source_thread_id: Originating thread id.
source_message_id: Originating message id.
source_tool_name: Originating tool name.
importance: 0..1 retention weight.
decay_half_life_days: Per-row decay half-life for ranking.
confidence: 0..1 truth confidence.
links: Free-form initial graph links ({targetId, relation} rows).
scope: Isolation scope ({agentId?, appId?, workflowId?}); absence
means user-global.
Returns:
The created Memory.
retrieve
retrieve(memory_id: str) -> Memory
Retrieve a single memory by id.
update
update(memory_id: str, *, kind: Optional[str] = None, content: Optional[str] = None, summary: Optional[str] = None, tags: Optional[Sequence[str]] = None, category: Optional[str] = None, event_time: Optional[str] = None, valid_from: Optional[str] = None, valid_until: Optional[str] = None, source_thread_id: Optional[str] = None, source_message_id: Optional[str] = None, source_tool_name: Optional[str] = None, importance: Optional[float] = None, decay_half_life_days: Optional[float] = None, confidence: Optional[float] = None, links: Optional[Sequence[Mapping[str, Any]]] = None, change_note: Optional[str] = None) -> Memory
Update a memory and return the updated record.
Content changes append a new version. See create for the
per-field semantics.
delete
delete(memory_id: str) -> None
Delete a memory. Raises on failure; returns nothing.
Sharing & scope
share
share(memory_id: str, *, user_id: str) -> Dict[str, Any]
Share a memory with another user.
unshare
unshare(memory_id: str, *, user_id: str) -> Dict[str, Any]
Revoke a user's share on a memory.
toggle_public
toggle_public(memory_id: str) -> Dict[str, Any]
Toggle the public visibility flag on a memory.
update_scope
update_scope(memory_id: str, *, scope: Optional[Dict[str, Any]] = None) -> Dict[str, Any]
Re-scope a memory (owner-only).
Args:
memory_id: Target memory id.
scope: {agentId?, appId?, workflowId?}. An empty dict or None
moves the memory to user-global.
Returns:
{success, scope} with the resolved scope after normalization.
Other
add_link
add_link(memory_id: str, *, target_id: str, relation: str, weight: Optional[float] = None) -> MemoryLink
Create a directed link from this memory to another.
Args:
memory_id: Source memory id.
target_id: Target memory id.
relation: supports | contradicts | refines | related.
weight: Edge weight in [0, 1].
Returns:
The created MemoryLink.
assess
assess(memory_id: str) -> Dict[str, Any]
Run a relevance/quality assessment for a memory.
consolidate
consolidate(*, scope: Optional[Mapping[str, Any]] = None, config: Optional[Mapping[str, Any]] = None, dry_run: Optional[bool] = None) -> Dict[str, Any]
Consolidate/deduplicate memories per the supplied policy.
Args: scope: Narrow consolidation to one isolation scope. config: Free-form threshold overrides. dry_run: Return the plan without applying changes.
delete_link
delete_link(memory_id: str, target_id: str) -> None
Delete the link from memory_id to target_id.
export
export(**params) -> Dict[str, Any]
Export the Memory Library (optionally filtered) as a portable bundle.
import_memories
import_memories(*, memories: Sequence[Mapping[str, Any]], scope: Optional[Mapping[str, Any]] = None) -> Dict[str, Any]
Bulk-import memories from an export payload.
Args:
memories: Memory rows (the free-form shape /memory/export emits).
scope: Isolation scope to assign imported rows.
ingest
ingest(*, content: str, kind: str, tags: Optional[Sequence[str]] = None, scope: Optional[Mapping[str, Any]] = None, model: Optional[str] = None, candidate_k: Optional[int] = None) -> Dict[str, Any]
Ingest raw content; an LLM decides ADD/UPDATE/DELETE/NOOP and executes it.
Args:
content: The new piece of information (required).
kind: fact | episodic | semantic | instruction |
preference (required).
tags: Tags for the new row (used only when the judge picks ADD).
scope: Isolation scope ({agentId?, appId?, workflowId?}).
model: Override the judge LLM model.
candidate_k: How many similar memories to show the judge.
invalidate
invalidate(memory_id: str, *, superseded_by: Optional[str] = None) -> Dict[str, Any]
Mark a memory as invalidated (soft-retire without deleting).
Args: memory_id: Target memory id. superseded_by: Optional id of the memory that supersedes this one.
linked_to
linked_to(memory_id: str, **params) -> List[Memory]
List memories linked to the given memory.
record_access
record_access(memory_id: str) -> Dict[str, Any]
Record an access event against a memory (updates recency/usage).
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
search(*, query: str, k: Optional[int] = None, kind: Optional[str] = None, tags: Optional[Sequence[str]] = None, scope: Optional[Mapping[str, Any]] = None, rrf_k: Optional[int] = None, weights: Optional[Mapping[str, Any]] = None, decay_half_life_days_override: Optional[float] = None, as_of: Optional[str] = None, include_invalidated: Optional[bool] = None, rerank: Optional[bool] = None, rerank_model: Optional[str] = None) -> Dict[str, Any]
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.
Args:
query: Natural-language query (required).
k: Max results.
kind: Filter by memory kind.
tags: Filter by tags (OR).
scope: Isolation scope to narrow to.
rrf_k: RRF k constant.
weights: Free-form per-list RRF weights ({vector?, text?}).
decay_half_life_days_override: Override per-row decay for ranking.
as_of: ISO-8601 point-in-time filter.
include_invalidated: Include rows past their validity window.
rerank: Whether to apply a rerank pass.
rerank_model: Override the rerank model.
versions
versions(memory_id: str) -> List[MemoryVersion]
List the version history of a memory (most recent first).