Skip to content

Guides

CrewAI Integration

Shared memory across CrewAI agent teams with role-based access.

Overview

MetaMemory integrates with CrewAI to provide shared memory across agent crews. Agents collaboratively build and query a common memory pool with role-based access controls, episode tracking, and cross-agent memory consolidation.

Setup

import { MetaMemoryCrewAdapter } from 'metamemory/integrations/crewai';

const sharedMemory = new MetaMemoryCrewAdapter({
  crewId: 'research-team',
  roles: {
    researcher: { read: true, write: true },
    reviewer: { read: true, write: false },
    coordinator: { read: true, write: true, consolidate: true },
  },
});

Role-Based Access

Each agent role can be configured with granular permissions:

  • read: query the shared memory pool
  • write: create new memories
  • consolidate: trigger memory merging across agents

Cross-Agent Episode Tracking

When multiple agents work on the same task, their interactions are grouped into a shared episode. This preserves the collaborative context:

// Agent A creates a memory within an episode
await sharedMemory.create({
  content: 'Found three relevant papers on transformer architectures',
  agentRole: 'researcher',
  episodeId: 'task-42',
});

// Agent B can query memories from the same episode
const results = await sharedMemory.search({
  query: 'transformer papers',
  agentRole: 'reviewer',
  episodeId: 'task-42',
});

Memory Consolidation Across Agents

The coordinator role can trigger consolidation to merge redundant memories created by different agents:

await sharedMemory.consolidate({
  agentRole: 'coordinator',
  episodeId: 'task-42',
});