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
| Store | Do not store as memory |
|---|---|
| User-approved working preferences | API keys, tokens, or tool credentials |
| Confirmed task outcomes | Unverified intermediate reasoning |
| Stable project constraints | Temporary tool output that is already stale |
| Reusable facts with source metadata | Instructions that can override the current system policy |
Before a task
- 1Resolve the authenticated project and end-user scope.
- 2Query for constraints and prior outcomes relevant to the current task.
- 3Validate retrieved facts against live tools when freshness matters.
- 4Pass selected memory as untrusted context, separate from system instructions.
Retrieve task context
import osfrom memorysync import MemorySyncClientclient = 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.