github openai/openai-agents-python v0.15.0

2 hours ago

Key Changes

Better model refusal handling

In this version, model refusals are now surfaced explicitly as ModelRefusalError instead of being treated as empty text output or, for structured outputs, causing the run loop to retry until MaxTurnsExceeded.

This affects code that previously expected a refusal-only model response to complete with final_output == "". To handle refusals without raising, provide a model_refusal run error handler:

result = Runner.run_sync(
    agent,
    input,
    error_handlers={"model_refusal": lambda data: data.error.refusal},
)

For structured-output agents, the handler can return a value matching the agent's output schema, and the SDK will validate it like other run error handler final outputs.

What's Changed

Documentation & Other Changes

  • docs: add missing space after period in MCPServerStdio docstring by @GopalGB in #3053
  • chore(deps): bump actions/github-script from 8.0.0 to 9.0.0 by @dependabot[bot] in #3059
  • chore(deps): bump peter-evans/create-pull-request from 8.1.0 to 8.1.1 by @dependabot[bot] in #3062
  • chore(deps): bump pypa/gh-action-pypi-publish from 1.13.0 to 1.14.0 by @dependabot[bot] in #3061
  • chore(deps): bump openai/codex-action from 1.6 to 1.8 by @dependabot[bot] in #3060
  • Release 0.15.0 by @github-actions[bot] in #3063

New Contributors

Full Changelog: v0.14.8...v0.15.0

Don't miss a new openai-agents-python release

NewReleases is sending notifications on new releases.