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

# CrewAI

> Shared, persistent memory tools for a CrewAI crew.

Anona gives a CrewAI crew memory that persists across runs and is shared by
every agent in it, with no vector database to run and no LLM key to supply.

```bash theme={null}
pip install 'anona[crewai]'
```

## Setup

Give one or more agents Anona-backed memory tools. Each agent can then search
past memories and save new ones as part of its own reasoning, the same way it
would use any other tool.

```python theme={null}
from crewai import Agent
from anona.integrations import MemoryBridge
from anona.integrations.crewai import AnonaStorage

bridge = MemoryBridge(api_key="anona_live_...", space_id="research-crew")
storage = AnonaStorage(bridge=bridge)

researcher = Agent(
    role="Researcher",
    goal="Answer questions using both current research and what the crew "
         "already knows",
    backstory=(
        "An experienced researcher who keeps notes across projects. Before "
        "digging into a new question, check memory for anything relevant "
        "already known about it. After learning something worth keeping, a "
        "decision, a fact, a preference, save it for later runs."
    ),
    tools=[*existing_tools, *storage.as_tools()],
)
```

`as_tools()` returns two tools, named `Anona: Search memory` and `Anona: Save
memory`. Give them to every agent that should share the crew's memory.

Like any CrewAI tool, these are **agent-discretionary**: nothing calls them
automatically. The agent's LLM decides whether and when to reach for a tool
based on its `backstory`/`goal` and the task at hand, the same way it decides
whether to use a web-search or file-read tool. Say so explicitly, as in the
`backstory` above, or the model may never call `Anona: Search memory` even
though it's sitting right there in its tool list.

The `Anona:` prefix is deliberate: if the same agent also has CrewAI's own
memory enabled (`Crew(memory=True)` or an agent-level `memory=True`), CrewAI
auto-attaches its own memory tools too, named `Search memory` and `Save to
memory`. CrewAI dedups tools by name and silently keeps whichever set was
attached last, so an unprefixed name here could lose to, or quietly
shadow, CrewAI's own tool with no error and nothing in any log. The prefix
means Anona's tools and CrewAI's can coexist on the same agent without either
one going missing.

## Why tools, not `Crew(memory=...)`

CrewAI's built-in memory (`Crew(memory=True)` or `Memory(storage=...)`) does
its own embedding and LLM-driven analysis of everything it stores and
recalls, and hands a pluggable storage backend only a raw vector on
search, never the query text. That can't be bridged to Anona's managed,
text-based retrieval without running a local embedding model, which is
exactly the vector database this integration exists to remove. CrewAI's
memory tools sidestep all of that: an agent calls them with plain text and
gets plain text back, and Anona does the actual search and ranking
server-side.

It also means adopting Anona adds no second LLM requirement on top of
whatever model your agents already use. CrewAI's built-in memory needs its
own LLM and embedder for content analysis regardless of storage backend;
Anona-backed tools don't.

## Scoping

Pass `user_id`, `agent_id` or `session_id` to the bridge to isolate memory
inside a space, so one crew deployment can serve many end customers without
their memories mixing.

```python theme={null}
bridge = MemoryBridge(
    api_key="anona_live_...",
    space_id="research-crew",
    user_id="customer-42",
)
```

## `AnonaStorage` directly

`AnonaStorage(bridge=bridge)` also exposes plain `save(value)` /
`search(query)` / `reset()` methods (what `as_tools()` is built from), if
you want to call Anona from your own code rather than through the generated
tools. `reset()` is a deliberate no-op that logs a warning: Anona has no
all-or-nothing delete endpoint, and a partial wipe (list-then-delete, with no
transaction) is worse than none. Clear a space from the Anona dashboard
instead.

## Failure behaviour

If Anona is unreachable, the search tool reports no memories found and the
crew keeps running.

The save tool still returns `"Saved to memory."`, even when the write
failed. The bridge behind every adapter never raises, so there's no failure
for the tool to report. Read `"Saved to memory."` as "handed off," not as
confirmation the memory is durably stored.
