Skip to main content
This guide shows you how to build an agent that can search the web using Exa and synthesize the results using OpenAI. This is perfect for building research agents or bots that need real-time information.

Prerequisites

  • cycls installed
  • OpenAI API key
  • Exa API key (get one here)

Step 1: Define the Search Tool

First, we’ll define a Python function that uses the exa-py client to search the web.

Step 2: Define the Tool Schema

Tell OpenAI about our search tool so it knows when to use it.

Step 3: Create the Agent

Full Code

Create an app.py file with the following content:

Configuration

Make sure your .env file contains both API keys: