Skip to main content

A Python adapter for using Google Gemini with OpenAI Agents SDK

Project description

AgentSDK Gemini Adapter

A Python adapter for using Google Gemini with OpenAI Agents SDK. This package provides a seamless integration between Google's Gemini models and the OpenAI Agents SDK.

Installation

pip install agentsdk-gemini-adapter

Quick Start

  1. Set up your Gemini API key in a .env file:
GEMINI_API_KEY=your_gemini_api_key_here
  1. Import and use the config:
from agentsdk_gemini_adapter import config

# Now you can use the config with OpenAI Agents SDK
# The config includes a pre-configured Gemini model

Features

  • Pre-configured Gemini 2.0 Flash model
  • Seamless integration with OpenAI Agents SDK

Requirements

  • Python 3.7+
  • Gemini API Key
  • OpenAI Agents SDK

Dependencies

This package requires openai-agents to be installed separately:

pip install openai-agents

Note: python-dotenv will be installed automatically as a dependency of openai-agents.

Usage Example

from agents import Agent, Runner
from agentsdk_gemini_adapter import config

# Create an agent using OpenAI Agents SDK
agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant.",
)

# Pass the Gemini configuration in run_config to any Runner method
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.", run_config=config)
print(result.final_output)

Configuration

The package automatically:

  • Loads your GEMINI_API_KEY from environment variables
  • Configures the Gemini client with the correct base URL
  • Sets up the Gemini 2.0 Flash model
  • Creates a ready-to-use RunConfig object

License

MIT License - see LICENSE file for details.

Contribution

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentsdk_gemini_adapter-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentsdk_gemini_adapter-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file agentsdk_gemini_adapter-0.1.0.tar.gz.

File metadata

  • Download URL: agentsdk_gemini_adapter-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for agentsdk_gemini_adapter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7269dcef449f87b035c971ba61c3effaff29ca2ddc6a610e75ef56713794bf3e
MD5 cdcea24a4aafc5e13635ba3e979223f6
BLAKE2b-256 647bf9b7e9c9079fb64f4dc1ea56717b1baeefbedffc334c57aca1c1980d0692

See more details on using hashes here.

File details

Details for the file agentsdk_gemini_adapter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentsdk_gemini_adapter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e6ff55c0e779570e0e62ff303d311e78180d4825f216464bbf724f0688302ab
MD5 71a57cfb21b439c8a3e78216002cf64c
BLAKE2b-256 4f0f16bc6c92785234ea848792aa1668f46e3380382036419891dc91ef8eac77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page