Skip to main content
AG2 is an open-source framework for building agents and multi-agent applications. It ships ExaToolkit, built on the Exa Python SDK: pass it to an agent and the model can search the web, find similar pages, read page contents, and get cited answers through Exa. Calls run on your own Exa API key.

Install

Install AG2 with your model provider’s extra and the Exa Python SDK. Swap openai for your provider, such as anthropic or gemini.
Set EXA_API_KEY in your environment, or pass api_key to ExaToolkit.

Get your Exa API key

Create a key in the dashboard. New accounts start with free credits.

Add Exa to an agent

Passing the toolkit to an Agent registers all four Exa tools, and the model decides when to call them.
Python

Configure the tools

num_results and max_characters on the constructor set defaults for exa_search and exa_find_similar. Each tool is also a factory method on the toolkit (search(), find_similar(), get_contents(), answer()), so you can give an agent only the tools it needs and bind filters per agent:
Python
find_similar() takes num_results, include_domains, exclude_domains, category, and exclude_source_domain. Every parameter also accepts an AG2 Variable, resolved from the agent’s context at call time.

Resources

AG2 Exa docs

AG2’s reference for ExaToolkit and its factory methods.

AG2 on GitHub

View the framework source and the ExaToolkit implementation.
Last modified on October 7, 2026