Documentation

The complete guide to coordinating multi-agent systems with MemryAPI.

🤝 Multi-Agent Coordination

MemryAPI is built as a shared memory layer where multiple agents can read/write to a common context, scoped by organizations and projects.

Example: Research Workflow


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 memory

🛡️ Security & RBAC

Enterprise-grade scoping ensures that sensitive data stays isolated.

🔐 Hierarchical Scoping

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.

🕵️ Audit & Attribution

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.


📡 API Reference

Updated for multi-agent support (RBAC & Versioning).

MethodEndpointDescription
POST/api/v1/rememberStore a memory with attribution.
POST/api/v1/recallScoped retrieval search.
GET/api/v1/tracesObservability & Provenance logs.
POST

/remember

Stores a memory snippet in a specific project scope.

Key Parameters
memory_space_iduuidOptional. Overrides the key scope if allowed.
source_agentstringThe ID of the agent authoring the memory.
namespace_idstringLogical grouping (e.g. "q3-research").

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' }
});
POST

/recall

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
});
POST

/versioning

🕒 Snapshot Versioning

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.
GET

/traces

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
    }
  }]
*/

🔒 Privacy & Sovereignty

Paranoid Mode

Enforces zero-cloud data leakage by redacting PII and strictly using local-only inference (Ollama).