The complete guide to coordinating multi-agent systems with MemryAPI.
MemryAPI is built as a shared memory layer where multiple agents can read/write to a common context, scoped by organizations and projects.
import { MemryClient } from '@memryapi/sdk';
// Initialize agent with a Space-scoped API Key
const agent = new MemryClient('sk_space_8492...');
// 1. Store memory with agent attribution
const { id, version } = await agent.remember('Correlation found in Q3 data.', {
agent_id: 'research-agent-01',
namespace_id: 'q3-analysis'
});
console.log(`Stored version: ${version}`);
// 2. Recall shared context across the project
const { results } = await agent.recall('Are there correlations in Q3?');
// 3. Inspect provenance in metadata
console.log(results[0].metadata.api_key_id); // Track which agent auth'd the memoryEnterprise-grade scoping ensures that sensitive data stays isolated.
Data is organized into Organizations → Projects → Memory Spaces. API Keys can be hard-scoped to a specific Memory Space, ensuring that even if a key is compromised, the blast radius is limited to that single context.
Every operation is attributed to a specific api_key_id. Using thesource_agent parameter, you can track which specific agent in your swarm is responsible for each memory.
Updated for multi-agent support (RBAC & Versioning).
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/remember | Store a memory with attribution. |
| POST | /api/v1/recall | Scoped retrieval search. |
| GET | /api/v1/traces | Observability & Provenance logs. |
Stores a memory snippet in a specific project scope.
await memory.remember('Found a new research paper.', {
user_id: 'user_123',
memory_space_id: 'uuid-of-shared-space',
source_agent: 'extractor-bot',
metadata: { relevance: 'high' }
});Semantic search within a specific scope.
const { results } = await memory.recall('What research papers do we have?', {
memory_space_id: 'uuid-of-shared-space',
top_k: 5
});MemryAPI maintains a full history of your context evolution.
// Every update automatically creates a snapshot
const { version } = await memory.updateMemory(memoryId, {
content: 'Updated content with more detail'
});
// version increments (1 -> 2), previous state saved in memory_versions table.Advanced observability for multi-agent swarms.
// Trace query match IDs for debugging
const response = await fetch('https://api.memryapi.com/api/v1/traces', {
headers: { 'x-api-key': 'your_api_key' }
});
const { traces } = await response.json();
/*
traces: [{
operation_type: "recall",
metadata: {
matched_memory_ids: ["id_1", "id_2"],
results_count: 2,
total_duration_ms: 85
}
}]
*/Enforces zero-cloud data leakage by redacting PII and strictly using local-only inference (Ollama).