Skip to main content

openai-agents-python-providers

Community model providers for the OpenAI Agents SDK.

Because OpenAI's SDK is intentionally focused on first-party integrations, this package provides ready-to-use ModelProvider implementations for locally-hosted and OpenAI-compatible backends:

Provider Backend
OllamaProvider Ollama
LlamaCppProvider llama.cpp, vLLM, and any OpenAI-compatible server

Installation

pip install openai-agents-python-providers

# or with temporal support
pip install "openai-agents-python-providers[temporal]"

Quickstart

Ollama

Make sure Ollama is running and you have a model pulled:

import asyncio
import os
from agents import Agent, Runner, RunConfig
from openai_agents_providers import OllamaProvider

# Configure via environment or parameters
provider = OllamaProvider(
    model=os.getenv("MODEL_NAME", "llama3.2"),
    base_url=os.getenv("PROVIDER_URL", "http://localhost:11434/v1")
)

agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant.",
)

async def main():
    result = await Runner.run(
        agent,
        "What is the capital of France?",
        run_config=RunConfig(model_provider=provider),
    )
    print(result.final_output)

asyncio.run(main())

llama.cpp

Start a llama.cpp server:

llama-server --model my-model.gguf --port 8080
import asyncio
import os
from agents import Agent, Runner, RunConfig
from openai_agents_providers import LlamaCppProvider

provider = LlamaCppProvider(
    base_url=os.getenv("PROVIDER_URL", "http://localhost:8080/v1"),
    model=os.getenv("MODEL_NAME"),  # optional
    api_key="sk-anything",
)

agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant.",
)

async def main():
    result = await Runner.run(
        agent,
        "Explain quantum entanglement in one sentence.",
        run_config=RunConfig(model_provider=provider),
    )
    print(result.final_output)

asyncio.run(main())

Temporal Integration

This package works seamlessly with the Temporal OpenAI Agents Plugin. You can use local providers like OllamaProvider or LlamaCppProvider while running agents durably in Temporal workflows.

See examples/temporal/ for a complete "tool-as-activity" demonstration.

# Install temporal dependencies
uv sync --group temporal

# Start the worker (pointing to your infrastructure)
TEMPORAL_ADDRESS="temporal.example.com:7233" \
PROVIDER_TYPE="ollama" \
MODEL_NAME="llama3.2" \
uv run examples/temporal/worker.py

# Start the workflow
TEMPORAL_ADDRESS="temporal.example.com:7233" \
uv run examples/temporal/starter.py "What is the weather where I am?"

API Reference

OllamaProvider

OllamaProvider(
    *,
    base_url: str = "http://localhost:11434/v1",
    model: str | None = None,
    api_key: str = "ollama",
    **kwargs,          # forwarded to AsyncOpenAI
)
Parameter Default Description
base_url http://localhost:11434/v1 Ollama API base URL
model None Model name (e.g. "llama3.2", "qwen3:8b"). Overrides any name passed by the agent.
api_key "ollama" Ignored by Ollama; required by the OpenAI SDK.

LlamaCppProvider

LlamaCppProvider(
    *,
    base_url: str,
    model: str | None = None,
    api_key: str = "sk-anything",
    **kwargs,          # forwarded to AsyncOpenAI
)
Parameter Default Description
base_url (required) OpenAI-compatible API base URL, e.g. http://localhost:8080/v1.
model None Model name. Overrides any name passed by the agent.
api_key "sk-anything" Ignored by most backends; required by the OpenAI SDK.

License

MIT

Metadata

Release files for openai-agents-python-providers 1.0.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 openai-agents-python-providers 1.0.0
File Size Uploaded
openai_agents_python_providers-1.0.0.tar.gz 130.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openai-agents-python-providers 1.0.0
File Interpreter ABI Platform
openai_agents_python_providers-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 137.8 kB

Release files / openai_agents_python_providers-1.0.0.tar.gz

Download URL openai_agents_python_providers-1.0.0.tar.gz
Size 130.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7778bc965ca6a9084d3a6ab37b2e28abe9a51c9a8fd546a25db0a9219a78a1ff
BLAKE2b-256 checksum
How to use checksums
6c27cba4fa9b27f3fa090b4c6928e8ff788d329984a50ad0224bed0a096b542d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / openai_agents_python_providers-1.0.0-py3-none-any.whl

Download URL openai_agents_python_providers-1.0.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a771a41ef86935a65c821cc9773936246af6dbdbf5fc13a243d83f61e53cd4f
BLAKE2b-256 checksum
How to use checksums
6be26ade0ff907cd438e394876ba0a650b48433ce6542ea3f0130282f9c76d3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.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