CrewAI agents using Zep maintain context across conversations, access shared knowledge bases, and make more informed decisions. This integration provides persistent context storage and knowledge retrieval for your CrewAI workflows.
External memory in CrewAI operates automatically during crew execution, providing context retrieval and persistence across tasks and executions.
Key Behaviors:
This automatic behavior means that once you configure Zep as your external memory provider, your CrewAI agents build context from past interactions and contribute new learnings without additional code.
Requires Python 3.10+, Zep CrewAI >=1.1.1, CrewAI >=0.186.0, and a Zep Cloud API key. Get your API key from app.getzep.com.
Set up your environment variables:
Use ZepUserStorage for personal context and conversation history:
User storage automatically routes data:
type: "message") → Thread API for conversation contexttype: "json" or type: "text") → User Graph for preferencesUse ZepGraphStorage for organizational knowledge that multiple agents can access:
Equip your agents with Zep tools for dynamic knowledge management:
Tool parameters:
Search tool:
query: Natural language search querylimit: Maximum results (default: 10)scope: Search scope - “edges”, “nodes”, “episodes”, or “all”Add data tool:
data: Content to store (text, JSON, or message)data_type: Explicit type - “text”, “json”, or “message”Define entity models for better knowledge organization:
Combine user and graph storage for comprehensive memory:
Agents can search existing knowledge and add new discoveries:
client: Zep client instance (required)user_id: User identifier (required)thread_id: Thread identifier (optional, enables conversation context)search_filters: Filter search results by node labels or attributesfacts_limit: Maximum facts for context (default: 20)entity_limit: Maximum entities for context (default: 5)client: Zep client instance (required)graph_id: Graph identifier (required)search_filters: Filter by node labels (e.g., {"node_labels": ["Technology"]})facts_limit: Maximum facts for context (default: 20)entity_limit: Maximum entities for context (default: 5)The integration automatically routes different data types to appropriate storage:
Here’s a complete example showing personal assistance with conversation memory: