Verified by the sovseal team
CrewAI Agent Memory Integration
Enhance CrewAI multi-agent teams with persistent, local-first memory using the sovseal MCP server.
Integrate CrewAI with sovseal to provide your collaborative agent teams with persistent, cross-run memory. By configuring the mcp-server tools, CrewAI agents can remember facts, project guidelines, and style preferences across tasks and sessions.
CrewAI agents share context using standard tool executions. Connecting the sovseal-mcp-server exposes store_memory and recall_memory as tools to the entire Crew.
Installation
Install CrewAI and the required MCP dependencies:
pip install crewai crewai-tools mcp-client-cli python-dotenvCrew Setup with Memory Tools
Below is a complete, runnable Python script showing how to instantiate CrewAI agents and tools connected to the local sovseal MCP server:
import os
import asyncio
from dotenv import load_dotenv
from crewai import Agent, Task, Crew, Process
from mcp_client import StdioMCPClient # Helper to load MCP tools
load_dotenv()
async def run_crew():
# 1. Start the local stdio MCP client
async with StdioMCPClient(
command="npx",
args=["-y", "@sovseal/mcp-server"]
) as mcp:
# Retrieve the recall and store tools
memory_tools = await mcp.get_crewai_tools()
# 2. Define specialized agents with memory capabilities
researcher = Agent(
role="Lead Project Researcher",
goal="Identify and index key architecture constraints",
backstory="You are an expert researcher. Use recall_memory to gather historical constraints.",
tools=memory_tools,
memory=True,
verbose=True
)
# 3. Create a task that utilizes those memory tools
research_task = Task(
description="Query the local memory node for 'database choices' and summarize findings.",
expected_output="A list of database technologies verified in previous runs.",
agent=researcher
)
# 4. Assemble the Crew
crew = Crew(
agents=[researcher],
tasks=[research_task],
process=Process.sequential,
verbose=True
)
# Execute the kickoff
result = crew.kickoff()
print("Crew Result:", result)
if __name__ == "__main__":
asyncio.run(run_crew())