Skip to content

Agent Memory

Zonrad agents remember. Each piece of stored knowledge is a MemoryItem — a typed, scoped fact that persists across runs and is automatically injected into relevant prompts.

MemoryItem Model

@dataclass
class MemoryItem:
memory_id: str # UUID
workspace_id: str
scope: MemoryScope # workspace | project | user | agent
scope_id: str # ID of the scoped entity
key: str # Semantic key, e.g. "company.mrr"
value: Any # JSON-serializable
summary: str # Human-readable description for prompt injection
source: str # "user_explicit" | "agent_inferred" | "api"
revision: int # Increments on each update (never overwrites)
parent_revision_id: str | None # Linked list of past values
created_at: datetime
updated_at: datetime
expires_at: datetime | None # Optional TTL
tags: list[str] # For retrieval filtering

Memory Scopes

Scope Scope ID Visible To Use Case
workspace workspace_id All agents, all users Company facts: MRR, team size, product name
project project_id Agents within a project Project-specific context: sprint goal, stakeholders
user user_id Agents called by this user Preferences: output format, language, verbosity
agent agent_id Specific agent only Agent-specific state: last run result, counter

The Super Agent loads memory items from narrowest to broadest scope and injects them into the system prompt before each step:

Agent prompt injection order:
1. agent-scoped items (most specific)
2. user-scoped items
3. project-scoped items
4. workspace-scoped items (most general)

Non-Destructive Revision Chains

Memory in Zonrad never deletes or overwrites — it creates a new revision:

Revision 1: { key: "company.mrr", value: 45000, revision: 1, parent: null }
│
▼
Revision 2: { key: "company.mrr", value: 52000, revision: 2, parent: "rev_1_id" }
│
▼
Revision 3: { key: "company.mrr", value: 58500, revision: 3, parent: "rev_2_id" }

You can always retrieve the full history of any key:

Terminal window
curl https://api.zonrad.ai/platform/v1/memory?key=company.mrr&history=true \
-H "Authorization: Bearer zon_live_YOUR_KEY"

Writing Memory

Terminal window
curl -X POST https://api.zonrad.ai/platform/v1/memory \
-H "Authorization: Bearer zon_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"scope": "workspace",
"key": "company.mrr",
"value": 58500,
"summary": "Current Monthly Recurring Revenue is $58,500",
"tags": ["finance", "metrics"]
}'

Reading Memory

Terminal window
# Get current value of a key
curl "https://api.zonrad.ai/platform/v1/memory?scope=workspace&key=company.mrr" \
-H "Authorization: Bearer zon_live_YOUR_KEY"
# List all workspace memory items
curl "https://api.zonrad.ai/platform/v1/memory?scope=workspace" \
-H "Authorization: Bearer zon_live_YOUR_KEY"
# Filter by tag
curl "https://api.zonrad.ai/platform/v1/memory?scope=workspace&tags=finance" \
-H "Authorization: Bearer zon_live_YOUR_KEY"

Automatic Memory (Agent-Inferred)

Agents can write memory automatically when they discover new facts. For example, the Board Updates agent writes the latest MRR to workspace memory after each run, so future runs have accurate numbers without re-fetching.

You can control this in Settings → Workspace → Auto-Memory to allow or block agent-inferred writes.

Deleting Memory

Memory items are soft-deleted (tombstoned) to preserve revision history:

Terminal window
curl -X DELETE "https://api.zonrad.ai/platform/v1/memory/{memory_id}" \
-H "Authorization: Bearer zon_live_YOUR_KEY"

A deleted item is no longer injected into agent prompts but remains retrievable via the history endpoint.