Skip to main content

CrewAI integration for MCAL - Goal-aware memory for AI agent crews

Project description

mcal-crewai

Goal-aware memory integration for CrewAI agent crews.

Installation

pip install mcal-crewai

Quick Start

Using MCALStorage (Mem0-style)

MCAL provides a storage backend that integrates directly with CrewAI's memory system:

from crewai import Crew, Agent, Task, Process
from crewai.memory.short_term.short_term_memory import ShortTermMemory
from crewai.memory.long_term.long_term_memory import LongTermMemory
from crewai.memory.entity.entity_memory import EntityMemory
from mcal_crewai import MCALStorage

# Create MCAL-backed memories
short_term = ShortTermMemory(
    storage=MCALStorage(type="short_term", user_id="john")
)
long_term = LongTermMemory(
    storage=MCALStorage(type="long_term", user_id="john")
)
entity_memory = EntityMemory(
    storage=MCALStorage(type="entities", user_id="john")
)

# Use with CrewAI
crew = Crew(
    agents=[agent],
    tasks=[task],
    memory=True,
    short_term_memory=short_term,
    long_term_memory=long_term,
    entity_memory=entity_memory,
)

Using External Memory

For cross-session persistence with goal awareness:

from crewai.memory.external.external_memory import ExternalMemory
from mcal_crewai import MCALStorage

external = ExternalMemory(
    embedder_config={
        "provider": "mcal",
        "config": {
            "user_id": "john",
            "llm_provider": "anthropic",
            "enable_goal_tracking": True,
        }
    }
)

crew = Crew(
    agents=[...],
    tasks=[...],
    external_memory=external,
    process=Process.sequential,
)

Features

Goal-Aware Memory

Unlike basic memory systems, MCAL tracks user goals and priorities:

storage = MCALStorage(
    type="long_term",
    user_id="project_manager",
    config={
        "enable_goal_tracking": True,
        "extract_priorities": True,
    }
)

Context Preservation

MCAL maintains reasoning context across agent handoffs:

# Agent 1 saves with context
await storage.save(
    "Research findings on market trends",
    metadata={
        "agent": "researcher",
        "goal": "market_analysis",
        "confidence": 0.95
    }
)

# Agent 2 retrieves with goal awareness
results = await storage.search(
    "What do we know about market trends?",
    limit=5,
    score_threshold=0.7
)

TTL Support

Automatic expiration for short-term memories:

storage = MCALStorage(
    type="short_term",
    user_id="session_user",
    default_ttl=3600,  # 1 hour
)

Configuration

Parameter Type Default Description
type str required Memory type: "short_term", "long_term", "entities", "external"
user_id str "default" User identifier for memory isolation
llm_provider str "anthropic" LLM for goal extraction
embedding_provider str "openai" Embedding model provider
default_ttl int None Default TTL in seconds
enable_goal_tracking bool True Enable goal extraction

API Reference

MCALStorage

class MCALStorage(Storage):
    """MCAL storage backend for CrewAI memory."""
    
    def save(self, value: Any, metadata: dict) -> None:
        """Save value with goal-aware processing."""
    
    def search(
        self, 
        query: str, 
        limit: int = 5, 
        score_threshold: float = 0.6
    ) -> list:
        """Search with goal-aware relevance."""
    
    def reset(self) -> None:
        """Clear all stored memories."""

Comparison with Mem0

Feature Mem0 MCAL
Basic Memory
Goal Tracking
Priority Extraction
Context Preservation
TTL Support
Local Storage
Cloud API Coming

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcal_ai_crewai-0.2.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcal_ai_crewai-0.2.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file mcal_ai_crewai-0.2.0.tar.gz.

File metadata

  • Download URL: mcal_ai_crewai-0.2.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for mcal_ai_crewai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f79803ccba7dfe14cc63955a887a6b0196a8941540240a140ac852dbda413a47
MD5 638c8405184cea5abe7598b608328257
BLAKE2b-256 af22b0a8a60b3b37b8ad3dfddfa118df31d94ab147bf860de7ca24b6b9136ee5

See more details on using hashes here.

File details

Details for the file mcal_ai_crewai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcal_ai_crewai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for mcal_ai_crewai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8b2355a09574b22e4cb139b8df5aca06b7362116413a8250fd71cb6f3b07f9b
MD5 c522863c344f7e93f46f1e4d48d327b1
BLAKE2b-256 d6bb2ded37b9371cc55e5cb9f0dc48fc98659a106679c990288d149506a1506a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page