from aegis_memory.integrations.crewai import AegisCrewMemory
from crewai import Crew, Agent, Task
# Initialize persistent memory
memory = AegisCrewMemory(
api_key="your-aegis-key",
namespace="market-research"
)
# Define agents
researcher = Agent(
role="Market Researcher",
goal="Gather comprehensive market data",
backstory="Expert in market analysis with 10 years experience",
memory=True
)
analyst = Agent(
role="Data Analyst",
goal="Analyze data and identify trends",
backstory="Statistical expert specializing in market trends",
memory=True
)
writer = Agent(
role="Report Writer",
goal="Create clear, actionable reports",
backstory="Business writer with Fortune 500 experience",
memory=True
)
# Define tasks
research_task = Task(
description="Research the AI agent market size and growth",
expected_output="Market data with sources",
agent=researcher
)
analysis_task = Task(
description="Analyze research data for key insights",
expected_output="Top 5 market trends with supporting data",
agent=analyst
)
report_task = Task(
description="Write executive summary of findings",
expected_output="2-page executive summary",
agent=writer
)
# Create and run crew with memory
crew = Crew(
agents=[researcher, analyst, writer],
tasks=[research_task, analysis_task, report_task],
memory=memory,
verbose=True
)
result = crew.kickoff()
# Next time you run this crew, it remembers:
# - What sources were reliable
# - What analysis approaches worked
# - What report formats were effective