Skip to content

feat: add Exa search tools for AutoGen#7656

Open
10ishq wants to merge 5 commits into
microsoft:mainfrom
10ishq:fix/add-exa-search-tools
Open

feat: add Exa search tools for AutoGen#7656
10ishq wants to merge 5 commits into
microsoft:mainfrom
10ishq:fix/add-exa-search-tools

Conversation

@10ishq
Copy link
Copy Markdown

@10ishq 10ishq commented May 5, 2026

Why are these changes needed?

AutoGen currently has no built-in web search tool. This PR adds four tools that wrap the Exa search API, giving agents a turnkey way to search the web, discover similar pages, retrieve page content, and get AI-generated answers with citations.

An Exa integration was recently shipped in AG2's beta module (ag2ai/ag2#2714). This PR brings the same capabilities to AutoGen, following the BaseTool/Component patterns used by the existing tools in autogen-ext.

Tools

Tool Description
ExaSearchTool Web search with optional text content retrieval
ExaFindSimilarTool Discover pages similar to a given URL
ExaGetContentsTool Retrieve full text for known URLs
ExaAnswerTool AI-generated answer with citations

Each tool:

  • Inherits from BaseTool and Component with Pydantic arg/return models
  • Supports serialisation via _to_config / _from_config
  • Has Google-style docstrings with Args sections and code examples
  • Uses the current Exa API (exa-py v2) with no deprecated parameters
  • Passes integration_source="autogen" to the Exa client for usage tracking

Installation

pip install -U "autogen-ext[exa]"

Quick start

from autogen_ext.tools.exa import ExaSearchTool, ExaAnswerTool

search = ExaSearchTool(num_results=5, search_type="auto")
answer = ExaAnswerTool()

agent = AssistantAgent("researcher", model_client=model, tools=[search, answer])

Changes

  • New module autogen_ext/tools/exa/_exa_tools.py and __init__.py
  • Tests tests/tools/exa/test_exa_tools.py — 17 tests covering all four tools
  • Dependency Added exa optional extra (exa-py>=2.0.0,<3) to pyproject.toml
  • Lock file Regenerated uv.lock to include exa-py

Related issue number

Checks

10ishq added 2 commits May 5, 2026 15:34
Add four tools wrapping the Exa neural search API:
- ExaSearchTool: web search with optional text content
- ExaFindSimilarTool: discover pages similar to a given URL
- ExaGetContentsTool: retrieve full text for known URLs
- ExaAnswerTool: AI-generated answer with citations

Each tool follows the BaseTool/Component pattern with Pydantic
arg/return models, serialisable config, and full test coverage.

The Exa client is initialised with integration_source='autogen'
for usage tracking. All tools are exposed under the 'exa' optional
dependency extra in autogen-ext.
@10ishq
Copy link
Copy Markdown
Author

10ishq commented May 5, 2026

@microsoft-github-policy-service agree company="Exa"

10ishq added 3 commits May 5, 2026 15:52
- Add Google-style Args sections to all __init__ docstrings
- Remove 'neural' from module-level docstring
- Remove unused Type/Union imports
- Regenerate uv.lock to include exa-py
The lockfile regeneration pulled in unrelated version bumps across
the entire workspace.  Drop the change so the PR diff stays focused
on the Exa tools.
exa-py v2.12.1 does not accept an integration_source keyword
argument.  Set the x-exa-integration header on the client directly.
@10ishq
Copy link
Copy Markdown
Author

10ishq commented May 5, 2026

Test Results

Tested locally against the real Exa API (exa-py v2.12.1) and with the existing unit test suite.

Unit Tests (17/17 passed)
tests/tools/exa/test_exa_tools.py::TestExaSearchTool::test_basic_search PASSED
tests/tools/exa/test_exa_tools.py::TestExaSearchTool::test_search_with_all_params PASSED
tests/tools/exa/test_exa_tools.py::TestExaSearchTool::test_search_with_text_content PASSED
tests/tools/exa/test_exa_tools.py::TestExaSearchTool::test_search_empty_results PASSED
tests/tools/exa/test_exa_tools.py::TestExaSearchTool::test_search_handles_none_title PASSED
tests/tools/exa/test_exa_tools.py::TestExaSearchTool::test_search_tool_schema PASSED
tests/tools/exa/test_exa_tools.py::TestExaSearchTool::test_search_tool_config_round_trip PASSED
tests/tools/exa/test_exa_tools.py::TestExaFindSimilarTool::test_basic_find_similar PASSED
tests/tools/exa/test_exa_tools.py::TestExaFindSimilarTool::test_find_similar_with_params PASSED
tests/tools/exa/test_exa_tools.py::TestExaFindSimilarTool::test_find_similar_tool_schema PASSED
tests/tools/exa/test_exa_tools.py::TestExaGetContentsTool::test_get_contents PASSED
tests/tools/exa/test_exa_tools.py::TestExaGetContentsTool::test_get_contents_multiple_urls PASSED
tests/tools/exa/test_exa_tools.py::TestExaGetContentsTool::test_get_contents_tool_schema PASSED
tests/tools/exa/test_exa_tools.py::TestExaAnswerTool::test_basic_answer PASSED
tests/tools/exa/test_exa_tools.py::TestExaAnswerTool::test_answer_no_citations PASSED
tests/tools/exa/test_exa_tools.py::TestExaAnswerTool::test_answer_handles_none_title PASSED
tests/tools/exa/test_exa_tools.py::TestExaAnswerTool::test_answer_tool_schema PASSED
Integration Tests (real Exa API)
Test Result Details
ExaSearchTool Passed 3 results returned with titles, URLs, scores
ExaFindSimilarTool Passed 2 similar pages for exa.ai
ExaGetContentsTool Passed 4686 chars retrieved from exa.ai
ExaAnswerTool Passed 1134-char answer with 8 citations
x-exa-integration header Passed Header set to autogen on client
Config round-trip Passed All 12 fields preserved
ImportError message Passed Correct install instructions shown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant