Skip to main content

openai-sdk-helpers

PyPI version Python versions License: MIT

Small, typed, SDK-first primitives for composing OpenAI Responses, Agents, files, vector stores, tools, and Codex plugins.

Install · Choose a surface · Capabilities · Security · Roadmap

Product contract

openai-sdk-helpers complements the official openai and openai-agents Python packages. It provides reusable production primitives without replacing the SDKs, hiding API calls, owning application prompts, or becoming a universal agent framework.

Every public helper should be:

  • typed and predictable;
  • thin enough that official SDK concepts remain recognizable;
  • explicit about network calls, resource ownership, and cleanup;
  • usable without unrelated optional integrations;
  • tested without requiring paid API calls in pull-request CI;
  • backward-compatible or accompanied by deliberate migration guidance.

See PRODUCT.md for the full product vision and feature acceptance test.

Installation

The core package installs both official OpenAI Python SDKs and no UI or LangExtract dependency:

pip install openai-sdk-helpers

Optional profiles:

pip install "openai-sdk-helpers[extract]"  # LangExtract-backed extraction
pip install "openai-sdk-helpers[ui]"       # Streamlit application helpers
pip install "openai-sdk-helpers[all]"      # All current optional capabilities

Python 3.10–3.13 is validated in CI. The distribution includes py.typed. See docs/installation.md for profile details, feature-specific SDK requirements, and missing-extra behavior.

Choose a surface

Responses

Use openai_sdk_helpers.response when the application needs direct control of Responses API inputs, response identifiers, message history, custom tool handlers, files, or raw streaming events.

from openai_sdk_helpers import OpenAISettings
from openai_sdk_helpers.response import ResponseBase

settings = OpenAISettings.from_env()

with ResponseBase(
    name="reviewer",
    instructions="Review the supplied code.",
    tools=None,
    output_structure=None,
    tool_handlers={},
    openai_settings=settings,
) as response:
    result = response.run_sync("Review: def add(a, b): return a + b")
    print(result)

Agents

Use openai_sdk_helpers.agent when the application benefits from the official Agents SDK loop, tools, sessions, guardrails, handoffs, or tracing.

from openai_sdk_helpers.agent import SummarizerAgent

agent = SummarizerAgent(default_model="your-model")
result = agent.run_sync("Summarize this text in one sentence.")
print(result.text)

Managed Agents API

Use openai_sdk_helpers.managed_agents when the application needs OpenAI-managed durable agent sessions and the managed execution harness. This surface requires an OpenAI Python SDK exposing beta.agents.sessions (3.13.0 or later) without raising the package-wide SDK minimum for other helpers.

from openai import OpenAI
from openai_sdk_helpers.managed_agents import ManagedAgentsClient

client = OpenAI()
managed = ManagedAgentsClient(client)
session = managed.create_session(
    environment={"type": "openai_hosted"},
    agent_id="agent_123",
    input="Inspect the repository.",
)

Streaming, artifacts, subagents, and other evolving beta resources remain available directly through managed.sessions and managed.agents. See docs/managed-agents.md for compatibility and execution boundaries.

Decisions

Use openai_sdk_helpers.decisions for fast typed predicates, fixed choices, and ordered scoring when generation or an agent loop would be unnecessary. The GA-compatible Decisions surface uses the package-wide OpenAI Python SDK minimum (openai>=3.37.0). It accepts JSON/tool history, structured instructions, and native prompt caching parameters.

from openai import OpenAI
from openai_sdk_helpers.decisions import DecisionsClient

decision = DecisionsClient(OpenAI())
answer = decision.predicate(
    "The request asks for a routine account lookup.",
    instructions="Should this request use the standard support path?",
    name="standard_path",
)

Batch questions, multimodal inputs, usage, refusals, and future model identifiers remain available through the official SDK-shaped interface. See docs/decisions.md for the execution boundary and examples.

Codex plugins

Use openai_sdk_helpers.codex when a separately packaged capability should register typed commands through deterministic entry-point discovery.

openai-helpers codex plugins
openai-helpers codex commands

See docs/codex-plugins.md for the plugin protocol, lifecycle, discovery, compatibility, and packaging guide.

Direct SDK calls

Use the official SDK directly when a package helper would only rename parameters or obscure the underlying client, resource, response, event, or exception. Access to underlying SDK objects is part of this project's escape- hatch policy.

The canonical inventory of shipped and planned surfaces is docs/capabilities.md.

Core capabilities

  • centralized OpenAI settings and client creation;
  • optional shared operation metadata and lifecycle observers;
  • explicit conversation-state ownership and persistence contracts;
  • Responses API orchestration, structured outputs, files, tools, and websocket helpers;
  • Agents SDK wrappers, runners, search workflows, and reusable text agents;
  • capability-gated managed Agents API session lifecycle helpers;
  • capability-gated Decisions API helpers for predicates, choices, and scores;
  • typed Pydantic structures and Jinja prompt rendering;
  • file and vector-store helpers;
  • output validation and shared tool contracts;
  • deterministic Codex plugin registration, discovery, inspection, and lifecycle;
  • optional LangExtract and Streamlit integrations;
  • local CLI inspection without hidden API calls.

Detailed maturity, installation, execution, and escape-hatch information lives only in the capability matrix.

Configuration

OpenAISettings loads standard configuration from environment variables or a local .env file and creates official SDK clients:

from openai_sdk_helpers import OpenAISettings

settings = OpenAISettings.from_env()
client = settings.create_client()

Common variables include OPENAI_API_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID, OPENAI_BASE_URL, OPENAI_MODEL, OPENAI_TIMEOUT, and OPENAI_MAX_RETRIES. Uncommon official client parameters remain available through extra_client_kwargs.

Security

Report suspected vulnerabilities through the repository's confidential GitHub private vulnerability reporting flow, not a public issue. Never include real credentials, customer prompts, model responses, uploaded files, or production logs. See SECURITY.md for supported versions, reporting guidance, and trust boundaries.

Documentation

Development

git clone https://github.com/fatmambot33/openai-sdk-helpers.git
cd openai-sdk-helpers
pip install -e ".[dev]"

pydocstyle src
black --check --diff .
pyright src
pytest -q --cov=src --cov-report=term-missing --cov-fail-under=70
python scripts/check_markdown_links.py

Additional CI validates Python 3.10–3.13, minimum and latest compatible OpenAI SDK versions, built distributions, installed entry points, supported examples, and isolated core, extract, ui, and all profiles.

See CONTRIBUTING.md and AGENTS.md before changing public behavior.

Scope boundaries

This project is not an end-user application, hosted platform, replacement SDK, universal agent framework, prompt catalog, storage service, protocol implementation, or transport framework. Application-specific business logic belongs in consuming projects.

Managed Agents API helpers shipped in 0.10.0. Decisions API helpers are the next priority because they add a distinct OpenAI execution primitive; Realtime API helpers follow afterward. Issue order and release gates are tracked in ROADMAP.md.

License

Licensed under the MIT License.

Metadata

Release files for openai-sdk-helpers 0.11.1

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-sdk-helpers 0.11.1
File Size Uploaded Provenance Actions
openai_sdk_helpers-0.11.1.tar.gz 180.1 kB With provenance Details for openai_sdk_helpers-0.11.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openai-sdk-helpers 0.11.1
File Interpreter ABI Platform Actions
openai_sdk_helpers-0.11.1-py3-none-any.whl Python 3 none any Details for openai_sdk_helpers-0.11.1-py3-none-any.whl

Total release size: 418.5 kB

Release files / openai_sdk_helpers-0.11.1.tar.gz

Download URL openai_sdk_helpers-0.11.1.tar.gz
Size 180.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d28c79ac69dff1cc3985a943e6ee9647f349ad4a8737698d46e3d8aaeab3d9df
BLAKE2b-256 checksum
How to use checksums
5c266612ff18ad381d33c326e2f0af4e9dd097e5ed398f0d32f806e1dbcbf505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / openai_sdk_helpers-0.11.1-py3-none-any.whl

Download URL openai_sdk_helpers-0.11.1-py3-none-any.whl
Size 238.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37e5b5b453ae811ca7db15a11e5ac01d33d6f8abe41d25d524ae2cba16d1e723
BLAKE2b-256 checksum
How to use checksums
79a140d71d554232184a898f8930533b3ce7a59b274cfdca116afd92c65e516d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Security for openai-sdk-helpers 0.11.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openai_sdk_helpers-0.11.1.tar.gz

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 Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.1 This release

2 release files Full provenance

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