![]() |
VOOZH | about |
Memory in CrewAI enables agents to retain past interactions, outputs and contextual information ensuring that tasks are carried out in a coherent and structured manner. In multi-agent workflows, agents must often build on previous work. Without memory, each agent would begin from scratch and lose context.
When the memory parameter is set to True for an agent or a crew, it enables short-term, long-term and entity memory. Together, these components ensure that agents can retain context, recall past work and build structured knowledge.
We will be implementing memory in CrewAI by enabling it for agents and inspecting how it stores and retrieves information across tasks and sessions.
We define three agents: a Writer, an Editor and a Publisher. The Writer has memory enabled to recall ideas and context while producing the manuscript.
Each task specifies a description, an agent responsible for execution and expected output. Tasks can also depend on the results of previous tasks.
The agents and tasks are grouped into a Crew. We specify a sequential process, meaning each task runs in order.
Output:
if memory=True was not enabled, the Editor would not automatically recall the Writer’s manuscript and would start editing without any context. With memory enabled, the Editor receives the Writer’s output as part of its context, leading to meaningful edits instead of disconnected results.
CrewAI stores memory locally. The following code retrieves the storage path and lists stored files.
Output:
CrewAI storage location: /root/.local/share/content
Stored files and directories:
latest_kickoff_task_outputs.db