Skip to main content

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.

Metadata

Release files for agentsdk-gemini-adapter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentsdk-gemini-adapter 0.1.0
File Size Uploaded
agentsdk_gemini_adapter-0.1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentsdk-gemini-adapter 0.1.0
File Interpreter ABI Platform
agentsdk_gemini_adapter-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / agentsdk_gemini_adapter-0.1.0.tar.gz

Download URL agentsdk_gemini_adapter-0.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7269dcef449f87b035c971ba61c3effaff29ca2ddc6a610e75ef56713794bf3e
BLAKE2b-256 checksum
How to use checksums
647bf9b7e9c9079fb64f4dc1ea56717b1baeefbedffc334c57aca1c1980d0692
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / agentsdk_gemini_adapter-0.1.0-py3-none-any.whl

Download URL agentsdk_gemini_adapter-0.1.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e6ff55c0e779570e0e62ff303d311e78180d4825f216464bbf724f0688302ab
BLAKE2b-256 checksum
How to use checksums
4f0f16bc6c92785234ea848792aa1668f46e3380382036419891dc91ef8eac77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page