API Reference
AgentMemory
The primary interface for reading, writing, and managing agent memory.Constructor
read
None if not found or below confidence threshold. The branch parameter selects which branch to read from (defaults to main).
write
memory_type parameter controls decay behavior — belief decays 2× faster, experience decays 1.5× slower.
The branch parameter determines which branch the entry is written to (defaults to main). Every write is also logged as an event on the agent’s git-like timeline.
The optional artifact_refs parameter links external blobs (S3 objects, files, URLs) to this entry. See ArtifactRef below.
list
include_superseded=True for full version history. The branch parameter selects which branch to list from.
search
depth controls progressive retrieval: 1 = Hot tier only, 2 = Hot + Warm, 3 = all tiers (default).
When query is provided, the text is forwarded to the adapter for full-text search (Postgres tsvector). When recall_config is also set, returns ScoredEntry objects sorted by composite recall score with a breakdown dict.
graph_neighbors
depth > 1 (Postgres adapter uses recursive CTE). The Filesystem and S3 adapters return an empty list.
timeline
semantic_search
embedder to be configured.
watch
cancel() method.
commit_outcome
causal_entry_keys is None, uses auto-causal linking (all entries read in this session).
The optional decision_summary parameter adds a human-readable description of the decision to the persisted trace.
When called, the trace automatically captures:
- Causal entry snapshots with full
value,memory_type,written_by, andread_attimestamps - Query events from all
search()andlist()calls during the session, with parameters, result counts, and per-operation latency - Error events from any failed operations
- Session timing —
session_started_at,session_ended_at,session_duration_ms - State diff — entries created, updated, and confidence changes
history
record_context
external_contexts field of explain() output, making decision traces complete.
explain
outcome_ref is provided, labels the explanation with that reference.
Returns:
briefing
Digest objects ranked by relevance to the given entity or agent context. If no Cortex is running, returns an empty list.
stats
MemoryEntry
ArtifactRef
Link memory entries to external blobs — model weights, datasets, logs, screenshots, or any binary artifact stored outside AMFS.Provenance
OutcomeType
MemoryType
ProvenanceTier
ConflictPolicy
RecallConfig
ScoredEntry
MemoryTier
TierConfig
PriorityScorer
S = (alpha * importance + beta * recency) * freq_boost * time_decay.
TierAssigner
ImportanceEvaluator
AgentMemory(importance_evaluator=...) to score entries on write. The Pro edition provides LLMImportanceEvaluator with 3-dimension scoring.
AdapterABC (new methods)
GraphEdge
GraphNeighborQuery
DigestType
Digest
A compiled knowledge digest produced by the Memory Cortex.MemoryStats
MCP Tools
When used via MCP, the following tool signatures are exposed:amfs_read
amfs_write
value is passed as a string. If it’s valid JSON, it’s parsed automatically; otherwise stored as a plain string.artifact_refs should be a dict with uri (required), and optionally media_type, label, and size_bytes.
amfs_search
depth controls progressive retrieval: 1 = Hot only, 2 = Hot + Warm, 3 = all (default).
amfs_list
amfs_stats
amfs_commit_outcome
amfs_record_context
amfs_explain() output.
amfs_history
amfs_explain
amfs_retrieve
ScoredEntry-shaped results with score breakdowns. Requires an embedder for the semantic signal; without one, ranking uses recency and confidence only.
amfs_graph_neighbors
depth > 1 for multi-hop traversal (Postgres adapter only).
amfs_timeline
HTTP REST API
When using the HTTP API server, the following REST endpoints are available:Entries
All entry endpoints accept a
branch parameter (query param for GET, body field for POST). Defaults to main. When targeting a non-main branch with the Pro branching module installed, the caller’s API key is checked against the branch access grants.
Agents & Timeline
Outcomes
Decision Traces
Observability
Admin — API Keys
Admin — Audit Log
Branching (Pro)
These endpoints are available when theamfs-branching module is installed:
Authentication is via the
X-AMFS-API-Key header. Set AMFS_API_KEYS to enable. Interactive API docs are available at /docs (Swagger UI).
Pro MCP Tools
The following tools are available only with the AMFS Pro MCP server.amfs_critique
amfs_briefing
amfs_distill
amfs_validate
amfs_retrieve
depth controls tier scope (same as amfs_search). When a learned model is trained (via amfs_retrain), it automatically contributes to ranking.
amfs_retrain
amfs_retrieve results automatically.
amfs_calibrate
per_entity=true to also produce entity-specific overrides.
amfs_export_training_data
"sft" (supervised fine-tuning), "dpo" (direct preference optimization), "reward_model" (reward model training). See the ML Layer guide for format details.
amfs_record_llm_call
total_llm_calls, total_tokens, and total_cost_usd in the trace.