📢 Announcing our research paper: Zentry achieves 26% higher accuracy than OpenAI Memory, 91% lower latency, and 90% token savings! Read the paper to learn how we're revolutionizing AI agent memory.
Build an AI system that combines CrewAI’s agent-based architecture with Zentry’s memory capabilities. This integration enables persistent memory across agent interactions and personalized task execution based on user history.
Set up initial conversation and preferences storage:
Copy
def store_user_preferences(user_id: str, conversation: list): """Store user preferences from conversation history""" client.add(conversation, user_id=user_id)# Example conversation storagemessages = [ { "role": "user", "content": "Hi there! I'm planning a vacation and could use some advice.", }, { "role": "assistant", "content": "Hello! I'd be happy to help with your vacation planning. What kind of destination do you prefer?", }, {"role": "user", "content": "I am more of a beach person than a mountain person."}, { "role": "assistant", "content": "That's interesting. Do you like hotels or airbnb?", }, {"role": "user", "content": "I like airbnb more."},]store_user_preferences("crew_user_1", messages)
def create_travel_agent(): """Create a travel planning agent with search capabilities""" search_tool = SerperDevTool() return Agent( role="Personalized Travel Planner Agent", goal="Plan personalized travel itineraries", backstory="""You are a seasoned travel planner, known for your meticulous attention to detail.""", allow_delegation=False, memory=True, tools=[search_tool], )
def create_planning_task(agent, destination: str): """Create a travel planning task""" return Task( description=f"""Find places to live, eat, and visit in {destination}.""", expected_output=f"A detailed list of places to live, eat, and visit in {destination}.", agent=agent, )
By combining CrewAI with Zentry, you can create sophisticated AI systems that maintain context and provide personalized experiences while leveraging the power of autonomous agents.