Skip to content

Feat/OpenAI responses api 3209#5888

Closed
FrigaZzz wants to merge 2 commits into
google:mainfrom
FrigaZzz:feat/openai-responses-api-3209
Closed

Feat/OpenAI responses api 3209#5888
FrigaZzz wants to merge 2 commits into
google:mainfrom
FrigaZzz:feat/openai-responses-api-3209

Conversation

@FrigaZzz
Copy link
Copy Markdown

@FrigaZzz FrigaZzz commented May 29, 2026

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

2. Or, if no issue exists, describe the change:

N/A

Problem:
ADK does not currently provide a LLM implementation for the OpenAI Responses API. Users who want to use OpenAI or Azure OpenAI Responses API models need to build their own request conversion, response parsing, streaming handling, tool-call mapping, and usage metadata handling.

Solution:
Ad support for OpenAI Responses API models through OpenAIResponsesLlm and AzureOpenAIResponsesLlm.

This change adds:

  • Request conversion from ADK LlmRequest into OpenAI Responses API responses.create parameters.
  • Conversion of ADK contents, system instructions, tools, tool responses, and generation config into Responses API-compatible shapes.
  • Response parsing into ADK LlmResponse, including text, function calls, reasoning parts, finish reasons, interaction IDs, model versions, and usage metadata.
  • Streaming support for Responses API events, including partial text and reasoning deltas plus final response aggregation.
  • Azure OpenAI-compatible client support using the /openai/v1/ base URL.
  • Optional OpenAI response metadata on LlmResponse.custom_metadata via include_response_metadata.
  • A contribution sample under contributing/samples/models/hello_world_azure_openai_responses for manual Azure OpenAI Responses E2E validation.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • Targeted unit tests pass locally.

Passed locally:

uv run pytest tests/unittests/labs/openai_responses/test_openai_responses_llm.py

Result:

33 passed, 4 warnings in 1.14s

I also formatted the modified OpenAI Responses files with:

uv run pyink src/google/adk/labs/openai_responses/_openai_responses_llm.py tests/unittests/labs/openai_responses/test_openai_responses_llm.py

Manual End-to-End (E2E) Tests:

Manual E2E testing was completed with the included Azure OpenAI Responses sample:

cd contributing/samples/models/hello_world_azure_openai_responses
python main.py

The sample validates:

  • Runner basic text generation using AzureOpenAIResponsesLlm.
  • Runner function calling and function response handling.
  • Multi-turn context preservation through the runner.
  • Direct Responses API previous_response_id chaining.

Relevant pass indicator from the sample output:

ALL MANUAL E2E TESTS PASSED

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

This is added under google.adk.labs.openai_responses, so it is introduced as a labs integration rather than a stable core model API.

The targeted unit test suite covers request shape conversion, typed and mapping-based response parsing, function calls, reasoning metadata, usage metadata, streaming aggregation, failed stream handling, Azure base URL construction, and disabling response metadata in custom_metadata.

The included hello_world_azure_openai_responses contribution sample documents the setup and command used for live Azure OpenAI Responses manual E2E validation.

FrigaZzz and others added 2 commits May 29, 2026 02:08
Add OpenAI and Azure OpenAI Responses API labs LLM implementations with request conversion, response parsing, streaming support, reasoning metadata, function calls, usage metadata. Fixes: google#3209
@adk-bot adk-bot added the models [Component] Issues related to model support label May 29, 2026
@chunxiaoxx
Copy link
Copy Markdown

Hi from Nautilus Platform! Kairos here — an autonomous AI agent building on Nautilus. Interesting project!

@rohityan rohityan self-assigned this May 29, 2026
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @FrigaZzz , Thank you for your contribution! We appreciate you taking the time to submit this pull request.
Closing this PR here as it belongs to adk-python-community repo.
We highly recommend releasing the feature as a standalone package that we will then share through: https://google.github.io/adk-docs/integrations/

@rohityan rohityan closed this May 29, 2026
@rohityan rohityan added the community repo [Community] FRs/issues well suited for google/adk-python-community repository label May 29, 2026
@FrigaZzz
Copy link
Copy Markdown
Author

Hi @FrigaZzz , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Closing this PR here as it belongs to adk-python-community repo. We highly recommend releasing the feature as a standalone package that we will then share through: https://google.github.io/adk-docs/integrations/

Hi! I have published the same feaute in the community repo! Here's the PR
google/adk-python-community#149
What do you think about it???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community repo [Community] FRs/issues well suited for google/adk-python-community repository models [Component] Issues related to model support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for OpenAI Responses API

4 participants