Skip to content
CrewAI

Research Agent with CrewAI

Build an autonomous research agent that searches the web, synthesizes findings, and produces structured reports — powered by CrewAI.

researchweb searchreportsautomation

Working Code

CrewAI
from crewai import Agent, Crew, Task
from langchain_openai import ChatOpenAI
from langchain_core.tools import tool
@tool
def web_search(query: str, max_results: int = 3) -> str:
"""Search the web for current information."""
from tavily import TavilyClient
client = TavilyClient()
results = client.search(query, max_results=max_results)
return "\n\n".join(
f"**{r['title']}**\n{r['content']}" for r in results["results"]
)
agent = Agent(
role="Specialist",
goal="You are a research assistant. Search the web to gather information, then synthesize findings into a structured report with citations.",
tools=[web_search],
llm=ChatOpenAI(model="gpt-4o"),
)
task = Task(
description="Compare the latest developments in AI agent frameworks in 2025",
expected_output="Detailed response",
agent=agent,
)
crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()
print(result.raw)

Step by Step

1

Install dependencies

Install CrewAI and the required tools for this use case.

2

Define your tools

Create the domain-specific tool functions your agent will use to interact with external services.

3

Create the agent and run

Initialize the CrewAI agent with your tools, set the system prompt, and execute a query.

Ready to build with CrewAI?

Generate a production-ready project with CrewAI pre-configured — FastAPI + Next.js, auth, streaming, and more.

Get Started

Ready to build your first production AI agent?

Open-source tools, battle-tested patterns, zero boilerplate. Configure your stack and ship in minutes — not months.