# Memory for CrewAI crews: context in the kickoff inputs and the history tools | Niadra

> How to give customer memory to a CrewAI crew: before_kickoff puts the context in the inputs as niadra_context, after_kickoff records the final answer, and tools hands over the history with the kit's schema. The crew's own memory stays CrewAI's. SDK code and limits.

URL: https://niadra.com/en/integracoes/crewai

Integration · CrewAI

# Memory for crews on CrewAI.

NiadraCrew gives you before\_kickoff, which puts the pack in the crew's inputs as niadra\_context, after\_kickoff, which records the final answer, and tools. The crew's short-term, long-term and entity memory stays CrewAI's; Niadra is the company's memory of the customer, shared with every other agent.

[Request early access](/en/enterprise)[The adapter's documentation(opens docs.niadra.com)](https://docs.niadra.com/en/integrations/crewai)

CrewAI's memory belongs to the crew: what its agents saw and learned, in the stores it keeps itself. It serves the crew. It does not serve another vendor's voice agent that will take the same customer tomorrow, nor the billing agent acting in the ERP, and it does not receive what those did.

With Niadra, the crew receives at kickoff the context the company has of the customer, through the niadra\_context input, which the task's description or the agent's backstory uses after your text. The crew's final answer goes back into the memory, and any agent, from any vendor, reads what it decided.

The minimal example, as the documentation has it

```
pip install 'niadra[crewai]'   # crewai 1.15 or newer, below 2; Python 3.11 to 3.13
```

```
"""A CrewAI crew whose task reads the customer's context."""

from crewai import Agent, Crew, Task

from niadra import Niadra, phone
from niadra.integrations.crewai import NiadraCrew

niadra = Niadra(channel="chat")
memory = NiadraCrew(niadra.conversation("thread-81", subject=phone("+5511912345678")))
support = Agent(role="Support", goal="Help the customer", backstory="You work for Acme.", tools=memory.tools)
answer = Task(
    description="Answer the customer: {message}\n\nWhat the company knows:\n{niadra_context}",
    expected_output="A short, specific answer.",
    agent=support,
)
crew = Crew(
    agents=[support],
    tasks=[answer],
    before_kickoff_callbacks=[memory.before_kickoff],
    after_kickoff_callbacks=[memory.after_kickoff],
)
print(crew.kickoff(inputs={"message": "Where is my replacement lid?"}).raw)
```

-   Python

The same code is in examples/crewai\_crew.py in the SDK repositories, where it runs in CI against the framework's real types and Niadra's emulator. To try it without Niadra's cloud, niadra-mock and NIADRA\_BASE\_URL=http://127.0.0.1:8765.

## How the adapter wires in

The five primitives of every Niadra integration, in this framework's extension points.

Context

before\_kickoff adds niadra\_context to the crew's inputs: the agent's notes (with agent\_memory=), the pack and the turn\_block. Place {niadra\_context} in a task's description or an agent's backstory, after your own text.

Turns

The input under message (or message\_key=) is the customer's turn, recorded before the crew starts; the crew's final answer is the agent's turn, recorded when it ends.

Tools

tools: CrewAI tools whose argument schema is the kit's, bound to the customer.

Verification

conversation.verify() before the kickoff.

Handoff

transferred\_to\_agent() and transferred\_to\_human() record the transfer.

## What the agent receives

The context is compiled when the memory changes and served ready, with no AI model on the read. What another channel said during the conversation arrives as a delta, at the end of the prompt.

-   Who the customer is, by what the conversation has proven: the verification level decides what goes in
-   Facts, open items and promises, with the date and the channel they came from
-   What other agents did inside the company, confirmed by the system of record
-   Patterns computed by rule, with the evidence and the expiry
-   The three history tools: search, timeline and open an item, bound to the customer in your code
-   A receipt of every read, chained by SHA-256

[See the context from the inside](/en/produtos/contexto)

## What the adapter does not do

-   The crew's own memory (short-term, long-term, entity) stays CrewAI's; Niadra is the company's memory of the customer, shared with every other agent.
-   Python 3.11 to 3.13 only: CrewAI's vector store depends on onnxruntime, which has no wheels for 3.10. The crewai, pipecat and openai-agents extras pin incompatible versions of a shared dependency: install one per environment.
-   Only the crew's final answer is recorded as the agent's turn, not each step.
-   Tested against crewai 1.15 with the model replaced by a fake and Niadra on the emulator.

## Frequently asked questions

### Should I switch off CrewAI's memory?

No need. The crew's memory keeps what its agents learned about the tasks; Niadra keeps what the company knows of each customer, from every channel. One complements the other, and the crew keeps running as it does today.

### How does the crew's agent find the context?

Through the niadra\_context input, which before\_kickoff adds. The task's description says {niadra\_context} after your text, like any interpolated CrewAI input. The history tools go in tools, for the agent to look up what the context does not answer.

### Does every step of the crew become a turn?

No. Only the crew's final answer is recorded as the agent's turn, and the input under message as the customer's turn. That is what other agents need to know: what the customer asked and what the crew decided.

### Do I have to change my model, my prompt or my vendor?

No. The adapter places the context after your instructions and the delta at the end of the prompt, in the extension points the framework already has. Your model, your prompt and your vendor stay the same, and switching any of them later does not erase the memory.

### Where does the data live, and what does it cost?

The data stays in a single region, stated in the contract, encrypted with AES-256-GCM under a key exclusive to your company and protected in a FIPS 140-3 HSM. The price is per conversation or task in which an agent read the memory: US$ 2 to 3 per thousand, by volume, with reads, searches and system events included. Niadra is opening to companies by request, before the public launch.

## Other integrations

-   [LiveKit Agents](/en/integracoes/livekit)
-   [Pipecat](/en/integracoes/pipecat)
-   [Vapi](/en/integracoes/vapi)
-   [Retell AI](/en/integracoes/retell)
-   [ElevenLabs Agents Platform](/en/integracoes/elevenlabs)
-   [Twilio](/en/integracoes/twilio)
-   [WhatsApp Cloud API](/en/integracoes/whatsapp)
-   [OpenAI Agents SDK](/en/integracoes/openai-agents)
-   [LangGraph](/en/integracoes/langgraph)
-   [LangChain](/en/integracoes/langchain)
-   [Vercel AI SDK](/en/integracoes/ai-sdk)
-   [n8n](/en/integracoes/n8n)
-   [All 36 integrations, in the documentation(opens docs.niadra.com)](https://docs.niadra.com/en/integrations/overview)

## Tell us what you are building.

A work email and two lines about your agents are enough. The people who write the code reply, with an early-access proposal for your case.

[Rather tell us more about your company? Use the full form](/en/enterprise)
