Skip to content

Python: Fix AttributeError in ResponsesAgentThreadActions._get_tool_calls_from_output #12301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2025

Conversation

ltwlf
Copy link
Contributor

@ltwlf ltwlf commented May 28, 2025

Summary

Fixes AttributeError: 'ResponseOutputMessage' object has no attribute 'call_id' in ResponsesAgentThreadActions._get_tool_calls_from_output

  • Updated type annotation from list[ResponseFunctionToolCall] to list[ResponseOutputItem < /dev/null | ResponseOutputMessage] to accurately reflect actual input types
  • Improved filtering to only process ResponseFunctionToolCall objects, safely ignoring other types like ResponseOutputMessage
  • Removed problematic .delta access and dangerous cast operations that caused the AttributeError

Test plan

  • All existing OpenAI responses agent tests pass (34/34)
  • Ruff formatting and linting passes
  • Pre-commit hooks pass

Fixes #12296

…alls_from_output

- Updated type annotation from list[ResponseFunctionToolCall] to list[ResponseOutputItem  < /dev/null |  ResponseOutputMessage] to accurately reflect actual input types
- Improved filtering to only process ResponseFunctionToolCall objects, safely ignoring other types like ResponseOutputMessage
- Removed problematic .delta access and dangerous cast operations that caused AttributeError: 'ResponseOutputMessage' object has no attribute 'call_id'

Fixes microsoft#12296

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ltwlf ltwlf requested a review from a team as a code owner May 28, 2025 21:50
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label May 28, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented May 28, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
agents/open_ai
   responses_agent_thread_actions.py34110768%167, 184, 195, 206–207, 374–376, 390, 395, 402, 420–421, 425, 469–471, 474, 492–493, 502–504, 508, 512–513, 517–519, 530–532, 554, 556–557, 564–565, 567–568, 570, 572–573, 575–576, 659–661, 673–674, 676–680, 682–688, 690–699, 701–702, 704–707, 714–716, 721, 723, 784–787, 828–829, 833–835, 837, 862–863, 865–869, 871, 881–882, 890, 894, 901, 907, 971
TOTAL27013457483% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3616 18 💤 0 ❌ 0 🔥 2m 0s ⏱️

@moonbox3 moonbox3 added this pull request to the merge queue May 29, 2025
Merged via the queue into microsoft:main with commit 4871024 May 29, 2025
28 checks passed
@github-project-automation github-project-automation bot moved this to Sprint: Done in Semantic Kernel May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Python: Bug: Streaming replies error – final ResponseOutputMessage missing .delta on large runs
4 participants