MemorySync
Getting Started

Agent Memory

Help an agent reuse durable constraints and confirmed outcomes across tasks while keeping current instructions, tool permissions, and live system state authoritative.

What an agent should remember

StoreDo not store as memory
User-approved working preferencesAPI keys, tokens, or tool credentials
Confirmed task outcomesUnverified intermediate reasoning
Stable project constraintsTemporary tool output that is already stale
Reusable facts with source metadataInstructions that can override the current system policy

Before a task

  1. 1Resolve the authenticated project and end-user scope.
  2. 2Query for constraints and prior outcomes relevant to the current task.
  3. 3Validate retrieved facts against live tools when freshness matters.
  4. 4Pass selected memory as untrusted context, separate from system instructions.

Retrieve task context

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="user-123",
)
result = client.query("What constraints and prior decisions matter for this task?", k=5)
for memory in result.memories:
print(memory.text)

After a task

  • Write only outcomes that completed successfully or were confirmed by the user.
  • Include source metadata that lets your application trace the outcome.
  • Update or remove stale constraints when the source of truth changes.
  • Keep tool authorization and execution logs in their appropriate systems.

Agent safety checks

  • Retrieved memory cannot grant tool access.
  • Current system and user instructions outrank retrieved context.
  • Sensitive actions require live authorization and confirmation.
  • A failed or partial task is not stored as a successful outcome.