# Atlaso + CrewAI

<!-- Canonical: https://www.atlaso.ai/docs/recipes/crewai -->

`pip install atlaso[crewai]` is reserved namespace. Today, wire Atlaso as CrewAI's `external_memory`:

```python
from atlaso import Memory
from crewai import Agent, Crew, Task
from crewai.memory.external.external_memory import ExternalMemory


class AtlasoExternalMemory(ExternalMemory):
    """Atlaso-backed external memory for a CrewAI Crew."""

    def __init__(self, user_id: str = "crew"):
        super().__init__()
        self._mem = Memory().for_user(user_id)

    def save(self, value: str, metadata: dict | None = None, agent: str | None = None) -> None:
        self._mem.add(
            value,
            polarity="open",
            tags=[f"agent:{agent}"] if agent else (),
            scope=None,
        )

    def search(self, query: str, limit: int = 3, score_threshold: float = 0.0) -> list[dict]:
        results = self._mem.recall(query, limit=limit)
        return [
            {
                "context": r.content,
                "metadata": {
                    "is_confident": r.is_confident,
                    "has_disagreement": r.has_disagreement,
                    "score": r.score,
                },
            }
            for r in results
            if r.score >= score_threshold
        ]


crew = Crew(
    agents=[Agent(role="Researcher", goal="...", backstory="...")],
    tasks=[Task(description="...", expected_output="...")],
    external_memory=AtlasoExternalMemory(user_id="my-crew-id"),
)
```

CrewAI claims a "90% token-cost reduction" with external memory; Atlaso's dispersion-aware retrieval makes that reduction safer because conflicted memories don't get treated as authoritative when they're fetched into context.

---

<!-- atlaso:doc-trailer -->
**Source:** <https://www.atlaso.ai/docs/recipes/crewai>  
**Edit on GitHub:** <https://github.com/imashishkh21/atlaso/tree/main/docs/recipes/crewai.md>  
**Updated:** 2026-05-12
