> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memanto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CrewAI Integration

> Integrate Memanto persistent memory into CrewAI agent workflows.

# CrewAI + Memanto

<img src="https://mintcdn.com/memanto/II1GP7bpRVzYh2QP/logo/integrations/crewai.svg?fit=max&auto=format&n=II1GP7bpRVzYh2QP&q=85&s=840409b4f8edf5c56e39dc57492e7a60" alt="CrewAI" width="140" style={{marginBottom: "1.5rem"}} data-path="logo/integrations/crewai.svg" />

Give your CrewAI agents persistent, cross-session memory powered by Memanto using the official `crewai-memanto` package.

By default, CrewAI agents lose context when a crew run ends. With Memanto, agents can store facts, decisions, and preferences — and recall them in future runs.

> **Important**: We recommend explicitly setting `memory=False` on your CrewAI `Crew` objects. This prevents CrewAI from auto-injecting its own temporary LanceDB memory tools, which can confuse agents when mixed with Memanto's persistent memory tools.

## How It Works

```text theme={null}
CrewAI Agent → Memanto Tools (remember / recall / answer) → Memanto Server → Moorcheh.ai
```

Each agent in your crew gets access to three tools: one to store memories, one to search them, and one to get a synthesized answer directly from memory. Memanto handles the semantic layer — no vector DB setup required.

## Prerequisites

* Python 3.10+
* [Moorcheh API key](https://console.moorcheh.ai/api-keys) (free tier: 100K ops/month)
* [OpenRouter API key](https://openrouter.ai/keys) (for CrewAI's LLM — free tier available)

## Install

```bash theme={null}
pip install crewai-memanto
```

## Quick Start

The `crewai-memanto` package provides pre-built tools that wrap Memanto's SDK. You don't need to make HTTP requests manually.

```python theme={null}
import os
from crewai import Agent, Task, Crew
from crewai_memanto import MemantoSetup, create_memanto_tools

# 1. Set up Memanto (one-time per session)
api_key = os.getenv("MOORCHEH_API_KEY")
setup = MemantoSetup(api_key=api_key)
client = setup.setup(agent_id="my-crew-agent")

# 2. Create memory tools bound to your agent
tools = create_memanto_tools(client, agent_id="my-crew-agent")

# 3. Give agents Memanto tools
researcher = Agent(
    role="Research Analyst",
    goal="Gather and store key facts about the topic",
    backstory="You are thorough and always save important findings for future reference.",
    tools=[tools["remember"], tools["recall"]],  # Persistent memory!
    verbose=True
)

writer = Agent(
    role="Content Writer",
    goal="Write a report using previously stored research",
    backstory="You rely on stored research to write accurate, grounded content.",
    tools=[tools["recall"], tools["answer"]],  # Reads persistent memory!
    verbose=True
)

research_task = Task(
    description="Research the latest trends in AI agents and store 5 key findings.",
    expected_output="Confirmation that 5 findings have been stored in memory.",
    agent=researcher
)

write_task = Task(
    description="Recall the stored AI agent findings and write a concise summary report.",
    expected_output="A 3-paragraph summary report grounded in recalled memory.",
    agent=writer
)

# 4. Run the crew with memory=False to prevent dual memory systems
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
    memory=False,  # Memanto handles memory via tools
    verbose=True
)

result = crew.kickoff()
print(result)
```

## Available Tools

The `create_memanto_tools` function returns a dictionary containing these pre-built CrewAI tools:

### `remember` (MemantoRememberTool)

Allows agents to store a piece of information in long-term memory.

* **Smart Categorization**: The tool schema has definitions for all 13 Memanto memory types (e.g., `fact`, `preference`, `observation`) baked directly into the prompt. The LLM intrinsically understands how to categorize what it discovers without you needing to explicitly define the types in your CrewAI `Task` description.
* **Confidence Scoring**: The agent is forced to actively evaluate its certainty on every memory it stores, assigning a mandatory confidence score between 0.0 (unverified) and 1.0 (objective fact).
* **Capacity**: Agents can store up to 10,000 characters per memory block.

### `recall` (MemantoRecallTool)

Allows agents to search long-term memory for relevant information using semantic search. Best used when the agent needs raw memory items to reason over.

### `answer` (MemantoAnswerTool)

Uses Memanto's built-in RAG to synthesize a response directly from stored memories — no extra LLM call needed from your agent.

> **Tip**: Use `answer` when the agent needs a ready-to-use response, such as for a final task output or a direct reply to a user, and use `recall` when they just need the raw data.

## Persistent Memory Across Runs

Because memories live in Memanto (not in-process), they persist between separate crew runs. Additionally, the integration handles all backend infrastructure automatically — you never need to manually provision databases or namespaces; the integration auto-creates the required secure Moorcheh namespaces the moment you initialize `MemantoSetup`.

```python theme={null}
# Run 1: researcher stores findings
crew.kickoff()

# Run 2 (next day): writer recalls those same findings
crew.kickoff()
```

No extra configuration needed — the `agent_id` ties memories together across runs.

## Next Steps

* [Check out the Full Examples Directory](https://github.com/moorcheh-ai/memanto/tree/main/examples/crewai-memory)
* [Remember API](/api-reference/data/remember)
* [Recall API](/api-reference/search/recall)
* [Memory Types Reference](/reference/memory-types)
