Skip to main content
Loading navigation
Back to prompt library

Initial CrewAI Setup and Agent Role Definition

Linked challenge: Misinformation Debunking Team

Prompt source

implementation56 lines11 sectionsNo variables1 code block
Set up a new CrewAI project. Define three agents: a 'Source Verifier' (role: verifying information against credible sources), a 'Content Analyzer' (role: identifying logical fallacies and inflammatory language), and a 'Report Generator' (role: synthesizing findings into a neutral report). Assign OpenAI o4o as the LLM for all agents. Define initial tasks for each agent and orchestrate a simple sequential process where the Verifier checks a claim, Analyzer reviews it, and Generator drafts a summary.

```python
# crew_main.py
from crewai import Agent, Task, Crew, Process
from langchain_openai import ChatOpenAI

# Initialize your OpenAI LLM
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0.7) # Using mini for example, use gpt-4o for full power

# Define Agents
source_verifier = Agent(
    role='Source Verifier',
    goal='Verify factual claims against established credible sources.',
    backstory='An expert in journalistic integrity and digital forensics.',
    llm=llm,
    verbose=True,
    allow_delegation=False
)

content_analyzer = Agent(
    role='Content Analyzer',
    goal='Identify logical fallacies, emotional appeals, and misleading rhetoric in content.',
    backstory='A linguist and critical thinking specialist.',
    llm=llm,
    verbose=True,
    allow_delegation=True
)

report_generator = Agent(
    role='Report Generator',
    goal='Synthesize verified information into a neutral, evidence-based debunking report.',
    backstory='A skilled technical writer and communicator.',
    llm=llm,
    verbose=True,
    allow_delegation=False
)

# Define Tasks (initial simple tasks)
verify_task = Task(
    description='Analyze the claim: "COVID-19 was caused by 5G towers" and find credible sources.',
    agent=source_verifier
)

analyze_task = Task(
    description='Review the claim and any findings from the Source Verifier. Identify rhetorical tactics.',
    agent=content_analyzer
)

generate_task = Task(
    description='Based on verified facts and analysis, draft a neutral debunking statement.',
    agent=report_generator
)

# Form the crew
crew = Crew(
    agents=[source_verifier, content_analyzer, report_generator],
    tasks=[verify_task, analyze_task, generate_task],
    process=Process.sequential,
    verbose=2
)

# Kick off the crew's work
# result = crew.kickoff()
# print(result)
```