Skip to main content
New to Exa? Try the Coding Agent Quickstart to get started in under a minute.

CrewAI is a framework for orchestrating AI agents that work together to accomplish complex tasks. In this guide, we’ll create a crew of two agents that generate a newsletter based on Exa’s search results. We’ll go over how to:
  1. Create a custom Exa-powered CrewAI tool
  2. Set up agents and assign them specific roles that use the Exa-powered search tool
  3. Organize the agents into a crew that will write a newsletter
CrewAI also ships a built-in ExaSearchTool you can drop in without writing a custom wrapper. The custom tool below is useful if you want full control over how results are formatted; either approach works.

Get Started

1

Pre-requisites and installation

Install the crewAI core, crewAI tools and Exa Python SDK libraries.
Python
2

Defining a custom Exa-based tool in crewAI

We set up a custom tool using the crewAI @tool decorator . Within the tool, we can initialize the Exa class from the Exa Python SDK, make a request, and return a parsed out result.
Python
Make sure your API keys are initialized properly. For this demonstration, the environment variable names are OPENAI_API_KEY and EXA_API_KEY for OpenAI and Exa keys respectively.

Get your Exa API key

3

Setting up CrewAI agent

Import the relevant crewAI modules. Then, define exa_tools to reference the custom search method we defined above.
Python
We then set up two agents and place them in a crew together:
  • One to research with Exa (providing the custom tool defined above)
  • Another to write a newsletter as an output (using an LLM)
Python
4

Defining tasks for the agents

Next, we’ll define tasks for each agent and create the crew overall using all of the components we’ve set up above.
Python
5

Kicking off the crew

Finally, we kick off the crew by providing a research topic as our input query.
Python
6

Output

As you can see, Exa’s search results enriched the output generation!
Stdout
Last modified on May 22, 2026