Skip to content
CrewAI

Agente de investigación con CrewAI

Construye un agente de investigación autónomo que busca en la web, sintetiza hallazgos y produce informes estructurados — con CrewAI.

researchweb searchreportsautomation

Código funcional

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)

Paso a paso

1

Instalar dependencias

Instala CrewAI y las herramientas necesarias para este caso de uso.

2

Definir herramientas

Crea las funciones de herramientas específicas del dominio que tu agente usará para interactuar con servicios externos.

3

Crear el agente y ejecutar

Inicializa el agente de CrewAI con tus herramientas, establece el prompt del sistema y ejecuta una consulta.

¿Listo para construir con CrewAI?

Genera un proyecto listo para producción con CrewAI preconfigurado — FastAPI + Next.js, auth, streaming y más.

Comenzar

¿Listo para construir tu primer agente IA en producción?

Herramientas open-source, patrones probados en batalla, cero boilerplate. Configura tu stack y despliega en minutos — no meses.