Python: Allow OpenAI function results without call IDs - #7928
Open
mikemikimike wants to merge 2 commits into
Open
Python: Allow OpenAI function results without call IDs#7928mikemikimike wants to merge 2 commits into
mikemikimike wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Allows OpenAI Responses API function results to omit call_id instead of serializing it as null.
Changes:
- Makes
Content.from_function_resultaccept an optional call ID. - Conditionally serializes
call_id. - Adds regression tests for ID-less results.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
python/packages/core/agent_framework/_types.py |
Makes result call IDs optional. |
python/packages/core/tests/core/test_types.py |
Tests ID-less result construction. |
python/packages/openai/agent_framework_openai/_chat_client.py |
Omits absent IDs from Responses payloads. |
python/packages/openai/tests/openai/test_openai_chat_client.py |
Tests serialization with no call ID. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| assert result["output"] == "Simple result" | ||
|
|
||
|
|
||
| def test_prepare_content_for_openai_function_result_without_call_id() -> None: |
Author
There was a problem hiding this comment.
Addressed in commit 69bba19: added the OpenAI function-result-without-call-ID row to docs/specs/004-python-function-calling-loop.md and linked it to test_prepare_content_for_openai_function_result_without_call_id.
mikemikimike
marked this pull request as ready for review
August 28, 2026 15:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
The OpenAI Responses API permits
function_call_outputitems without acall_id, but Agent Framework currently requires one when constructing function-result content and serializes an absent value as"call_id": null. This makes adapting OpenAI-compatible SDK payloads unnecessarily difficult.Description & Review Guide
Content.from_function_resultnow accepts an omitted call ID, and the OpenAI Responses serializer only includescall_idwhen one is provided.packages/openai/tests/openai/test_openai_chat_client.py.mcp,agent-hooks, and related workspace packages that are not installed in this checkout.Related Issue
Fixes #7922
Contribution Checklist