feat(adk): support responses API for Python ADK agents - #2679
Conversation
|
Will cherry-pick and open against |
927ad98 to
0bd7a1a
Compare
|
Is this ready for review, the upgrade tests are broken because of a bad release tag |
0bd7a1a to
7a70b71
Compare
Had a couple tweaks I wanted to make as well as some testing to do - all done now and ready for your 👀 |
There was a problem hiding this comment.
🟡 Changes recommended
The non-streaming Responses API path currently doesn’t surface status="failed" / error responses as LlmResponse errors, which can silently mask request failures.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR completes the earlier Go-only Responses API support by wiring Python ADK OpenAI agents to honor ModelConfig.openAI.apiFormat, enabling newer OpenAI models that require the Responses API (e.g., when using reasoning effort).
Changes:
- Add
api_formatto the Python ADK OpenAI model config and pass it through when instantiating the runtime LLM. - Implement Responses API request/response conversions and route OpenAI calls to
/v1/responseswhen configured. - Add unit tests covering conversions, request shaping (reasoning/tools/tokens), and streaming behavior for Responses API.
File summaries
| File | Description |
|---|---|
| python/packages/kagent-adk/tests/unittests/models/test_openai_responses.py | Adds unit tests for Responses API conversions and execution paths (streaming + non-streaming). |
| python/packages/kagent-adk/src/kagent/adk/types.py | Extends the OpenAI model config schema with api_format and plumbs it into LLM creation. |
| python/packages/kagent-adk/src/kagent/adk/models/_openai.py | Implements Responses API support (input/tools conversion, output conversion, streaming handling) and switches behavior based on api_format. |
| go/api/v1alpha2/modelconfig_types.go | Generalizes the OpenAI API format comment to apply to the ADK runtime (not Go-only). |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Responses API is required in order to use reasoning effort with newer Open AI models. kagent-dev#2369 (backported to `v0.10.x` in kagent-dev#2375) introduced support for use of the Responses API (configured via ModelConfig). However, that PR was strictly limited to golang agents and at present Python agents completely ignore the configuration and as such requests to a new model configured with reasoning effort will fail. This PR completes kagent-dev#2369 by ensuring that Python ADK agents also make use of the Responses API as per model configuration. Signed-off-by: Brian Fox <878612+onematchfox@users.noreply.github.com>
7a70b71 to
a83b0b5
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The Responses API support is fully wired through configuration, includes explicit error handling for failed responses, and is backed by thorough unit tests for both streaming and non-streaming paths.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
@EItanya see you enabled auto-merge - not sure this will merge automatically due to the broken upgrade tests will it? |
#2679 against main Disclaimer: got Claude to cherry-pick and handle conflicts - I don't have a working dev environment against main at present Signed-off-by: Brian Fox <878612+onematchfox@users.noreply.github.com> Co-authored-by: Eitan Yarmush <eitan.yarmush@solo.io>
Responses API is required in order to use reasoning effort with newer Open AI models. #2369 (backported to
v0.10.xin #2375) introduced support for use of the Responses API (configured via ModelConfig). However, that PR was strictly limited to golang agents and at present Python agents completely ignore the configuration and as such requests to a new model configured with reasoning effort will fail. This PR completes #2369 by ensuring that Python ADK agents also make use of the Responses API as per model configuration.