This repository provides implementations of AI agents utilizing the OpenAI Agents SDK. The agents included are:
- Basic Agent: A foundational agent demonstrating the core functionalities of the OpenAI Agents SDK.
- Weather Agent: An agent that fetches current weather information using the OpenWeatherMap API.
- Appointment Agent: An agent that interacts with Google Calendar API to search for and create events.
Before running the agents, ensure you have the following:
- Python 3.10+: The codebase is compatible with Python version 3.10 and above.
- OpenAI Agents SDK: A lightweight framework for building agentic AI applications.
- API Keys:
- OpenAI API Key: Required for utilizing the OpenAI Agents SDK.
- OpenWeatherMap API Key: Needed for the Weather Agent to fetch weather data.
- Google Calendar API Credentials: Necessary for the Appointment Agent to access and manage calendar events.
-
Clone the Repository:
git clone https://github.com/yourusername/ai-agents-repo.git cd ai-agents-repo
-
Set Up a Virtual Environment (Optional but recommended):
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Dependencies:
pip install -r requirements.txt
-
OpenAI API Key:
Set the
OPENAI_API_KEY
environment variable:export OPENAI_API_KEY='your_openai_api_key'
Replace
'your_openai_api_key'
with your actual OpenAI API key. -
OpenWeatherMap API Key:
Set the
OPEN_WEATHER_API_KEY
environment variable:export OPEN_WEATHER_API_KEY='your_openweather_api_key'
Replace
'your_openweather_api_key'
with your actual OpenWeatherMap API key. -
Google Calendar API Credentials:
Download your
credentials.json
from the Google Cloud Console and place it in the root directory of the project. Ensure the Google Calendar API is enabled for your project.
To run the Basic Agent:
python basic_agent.py
This agent serves as a template to understand the integration of the OpenAI Agents SDK.
To run the Weather Agent:
python weather_agent.py
This agent fetches current weather data for a specified location using the OpenWeatherMap API. Ensure the OPEN_WEATHER_API_KEY
is set as an environment variable.
To run the Appointment Agent:
python appointment_agent.py
This agent interacts with the Google Calendar API to search for and create events. Ensure that your credentials.json
is correctly configured and placed in the root directory.
- OpenAI Agents SDK: Documentation
- OpenWeatherMap API: Documentation
- Google Calendar API: Documentation
For any issues or contributions, please feel free to submit a pull request or open an issue in this repository.