Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openai/openai-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.24.0
Choose a base ref
...
head repository: openai/openai-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.25.0
Choose a head ref
  • 7 commits
  • 99 files changed
  • 7 contributors

Commits on Oct 2, 2026

  1. ci: standardize custom-code budget reporting (#4018)

    Aligns the existing custom-code budget tooling with the shared generated
    templates, including generated-file headers, documentation, and
    publisher test-fixture formatting.
    
    The existing API reference, runtime behavior, public API, and
    repository-owned budget policy remain unchanged.
    
    Validation: SDK formatting and all 59 offline custom-code tests passed
    locally, including the compiler hash contract.
    
    Co-authored-by: apcha-oai <[email protected]>
    apcha-oai and apcha-oai authored Oct 2, 2026
    Configuration menu
    Copy the full SHA
    b6ca5b5 View commit details
    Browse the repository at this point in the history
  2. feat(lib): export type_to_response_format_param publicly (#2993)

    Closes #2695
    
    ## Summary
    - Exports `type_to_response_format_param` from `openai.lib` so users can
    import it without reaching into private modules
    
    Currently users must import from `openai.lib._parsing._completions`,
    which is an internal path. This adds it to the public `openai.lib`
    namespace alongside the other publicly exported helpers.
    
    ## Test plan
    - Verified `from openai.lib import type_to_response_format_param` works
    - No behavior change — just a re-export
    
    ---------
    
    Co-authored-by: Marcus Wood <[email protected]>
    Bortlesboat and marcuswood-oai authored Oct 2, 2026
    Configuration menu
    Copy the full SHA
    becc1d2 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2026

  1. feat(agents): observe local tool failures (#4028)

    ## Summary
    
    Observe local tool failures without sending application exceptions to
    the model. Previously, logging inside a handler missed
    argument-validation failures before invocation and serialization
    failures after it returned:
    
    ```python
    with client.beta.agents.sessions.stream(
        SESSION_ID, input="Find catalog item A123.", tool_handlers=handlers,
    ) as stream:
        stream.until_done()
    ```
    
    Now attach an optional observer alongside the handlers:
    
    ```python
    def report_tool_error(failure):
        logger.error(
            "Tool %s failed during %s (call %s)",
            failure.tool_name, failure.stage, failure.call_id,
        )
    
    with client.beta.agents.sessions.stream(
        SESSION_ID, input="Find catalog item A123.", tool_handlers=handlers,
        on_tool_error=report_tool_error,
    ) as stream:
        stream.until_done()
    ```
    
    The beta `AgentToolError` carries the original local exception, failure
    stage, and call identifiers. `AsyncOpenAI` also accepts awaitable
    observers. Ordinary observer exceptions do not prevent submission of the
    sanitized tool failure; cancellation and API/stream errors retain their
    existing propagation. No automatic logging is added.
    apcha-oai authored Oct 5, 2026
    Configuration menu
    Copy the full SHA
    95d9645 View commit details
    Browse the repository at this point in the history
  2. feat(tools): support tool search (defer_loading=true) in typed functi…

    …on helpers (#4029)
    
    ## Summary
    
    Use deferred loading with typed tools without rebuilding their
    definitions or losing Pydantic argument parsing.
    
    Previously, Responses callers could add the option manually, but the
    compatibility conversion silently dropped it:
    
    ```python
    tool = openai.pydantic_function_tool(LookupItem)
    tool["function"]["defer_loading"] = True
    ```
    
    Now use a native Responses factory with either `responses.parse()` or
    `responses.stream()`:
    
    ```python
    tool = openai.pydantic_responses_function_tool(LookupItem, defer_loading=True)
    response = client.responses.parse(
        model=MODEL, input="Find catalog item A123.",
        tools=[{"type": "tool_search"}, tool],
    )
    # Function calls retain LookupItem instances in parsed_arguments.
    ```
    
    Agents bindings accept the option directly while keeping the same local
    handlers:
    
    ```python
    @function_tool(defer_loading=True)
    def lookup_item(item_id: str) -> str:
        """Look up a catalog item."""
        return catalog.lookup(item_id)
    
    tools = [{"type": "tool_search"}, lookup_item.definition]
    handlers = {lookup_item.name: lookup_item}
    ```
    
    The Agents `FunctionTool` constructor and Pydantic binding support the
    same option. Explicit `True`, `False`, and omission are preserved.
    Existing Responses compatibility conversion also retains added function
    options; schema normalization and execution behavior stay unchanged.
    apcha-oai authored Oct 5, 2026
    Configuration menu
    Copy the full SHA
    eec627f View commit details
    Browse the repository at this point in the history
  3. feat(agents): run local tools during streamed session creation (#4027)

    ## Summary
    
    Run local function tools on the first turn through
    `sessions.create(stream=True)`. This lets applications create a session
    with `environment={"type": "none"}`, handle its initial tool calls, and
    collect the answer in one stream.
    
    Before, automatic handlers were only available on a follow-up turn:
    
    ```python
    with client.beta.agents.sessions.stream(
        session.id, input="Find catalog item A123.",
        tool_handlers={lookup.name: lookup},
    ) as stream:
        result = stream.get_final_result()
    ```
    
    Now the same handlers work during creation:
    
    ```python
    with client.beta.agents.sessions.create(
        agent={"model": MODEL, "tools": [lookup.definition]},
        environment={"type": "none"}, input="Find catalog item A123.",
        stream=True, tool_handlers={lookup.name: lookup},
    ) as stream:
        result = stream.get_final_result()
    ```
    
    Works with synchronous and asynchronous clients, event iteration, and
    `output_type`. Both paths share the existing dispatcher and tool-output
    retry behavior; handlers stay local and are never serialized in the
    creation request.
    
    <!--
    Release Please: use the summary only; code examples in the squash commit
    body
    can confuse the conventional-commits parser.
    BEGIN_COMMIT_OVERRIDE
    feat(agents): run local tools during streamed session creation (#4027)
    END_COMMIT_OVERRIDE
    -->
    apcha-oai authored Oct 5, 2026
    Configuration menu
    Copy the full SHA
    919b623 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2026

  1. feat(api): add agent turn items and usage source grouping (#4030)

    ## Summary
    
    Adds paginated agent turn-item listing and API source grouping for usage
    and costs.
    
    ## Changes
    
    - Add a paginated list method for items in an agent session turn
    - Support api_source grouping and result fields for costs, completions
    usage, and web search usage
    - Support grouping costs by user_id
    - Add agent session error codes for spend limits and exhausted credits
    
    Co-authored-by: dpiet-oai <[email protected]>
    dpiet-oai and dpiet-oai authored Oct 6, 2026
    Configuration menu
    Copy the full SHA
    bd74c4e View commit details
    Browse the repository at this point in the history
  2. release: 3.25.0 (#4019)

    Automated Release PR
    ---
    
    
    ##
    [3.25.0](v3.24.0...v3.25.0)
    (2026-10-06)
    
    
    ### Features
    
    * **agents:** observe local tool failures
    ([#4028](#4028))
    ([95d9645](95d9645))
    * **agents:** run local tools during streamed session creation
    ([#4027](#4027))
    ([919b623](919b623))
    * **api:** add agent turn items and usage source grouping
    ([#4030](#4030))
    ([bd74c4e](bd74c4e))
    * **lib:** export type_to_response_format_param publicly
    ([#2993](#2993))
    ([becc1d2](becc1d2))
    * **tools:** support tool search (defer_loading=true) in typed function
    helpers ([#4029](#4029))
    ([eec627f](eec627f))
    
    ---
    This PR was generated with [Release
    Please](https://github.com/googleapis/release-please). See
    [documentation](https://github.com/googleapis/release-please#release-please).
    
    Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@users.noreply.github.com>
    openai-sdks[bot] authored Oct 6, 2026
    Configuration menu
    Copy the full SHA
    13fff1b View commit details
    Browse the repository at this point in the history
Loading