Skip to content

Python: Introduce the OpenAI Responses Agent #11240

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 28 commits into from
Apr 2, 2025

Conversation

moonbox3
Copy link
Contributor

@moonbox3 moonbox3 commented Mar 27, 2025

Motivation and Context

OpenAI recently released their Responses API, which is their newest core API and an agentic API primitive, combining the simplicity of Chat Completions with the ability to do more agentic tasks. Azure OpenAI also recently released the Responses API, with close-to feature parity with OpenAI's SDK. It gives us enough to introduce an AzureResponsesAgent and an OpenAIResponsesAgent to Semantic Kernel.

Description

This PR introduces:

  • The AzureResponsesAgent and OpenAIResponsesAgent
  • Allows use of the web search tool with OpenAI (Azure OpenAI currently doesn't support this).
  • Allows use of the file search tool with both OpenAI and Azure OpenAI.
  • Provides getting started samples for both agent types.

TODO:

  • Add unit test coverage for the ResponsesAgentThreadActions class.
  • Add support for the computer user agent tool.
  • Improve typing in the ResponsesAgentThreadActions class.
  • Closes Python: OpenAI Response Agent #11026

Contribution Checklist

@moonbox3 moonbox3 self-assigned this Mar 27, 2025
@moonbox3 moonbox3 requested a review from a team as a code owner March 27, 2025 22:24
@markwallace-microsoft markwallace-microsoft added python Pull requests for the Python Semantic Kernel documentation labels Mar 27, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Mar 27, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
semantic_kernel
   kernel.py2024777%143, 154, 158, 308–311, 427, 441–484
semantic_kernel/agents
   __init__.py10280%34, 38
semantic_kernel/agents/open_ai
   azure_responses_agent.py37370%3–118
   openai_responses_agent.py3007176%91–95, 99, 104, 109, 114, 120, 125–132, 137–142, 147–151, 157–169, 173–177, 267, 271, 275, 277, 283, 296, 298, 300, 302, 304, 397, 405, 408, 412, 414, 417, 440–447, 457, 497, 522, 533, 622, 740, 777, 854, 895–898, 913
   responses_agent_thread_actions.py3148872%158, 175, 186, 197–198, 365–367, 381–393, 411–416, 459–462, 465, 483–494, 499–500, 522–544, 625–689, 771–780, 810–811, 819–823, 830–836, 900
semantic_kernel/connectors/ai
   function_calling_utils.py50394%66, 181, 186
semantic_kernel/connectors/ai/open_ai/settings
   azure_open_ai_settings.py27485%126–129
semantic_kernel/contents
   annotation_content.py47198%64
   function_call_content.py110496%124, 201, 229–230
   function_result_content.py90199%94
TOTAL21687267488% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3363 5 💤 0 ❌ 0 🔥 1m 35s ⏱️

@TaoChenOSU
Copy link
Contributor

I see a mix of Responses Agent and Response Agent in code and comments. We should probably fix them.

alliscode
alliscode previously approved these changes Apr 2, 2025
@alliscode alliscode added this pull request to the merge queue Apr 2, 2025
Merged via the queue into microsoft:main with commit 329a35e Apr 2, 2025
28 checks passed
@github-project-automation github-project-automation bot moved this to Sprint: Done in Semantic Kernel Apr 2, 2025
glorious-beard pushed a commit to glorious-beard/semantic-kernel that referenced this pull request Apr 6, 2025
### Motivation and Context

OpenAI recently released their Responses API, which is their newest core
API and an agentic API primitive, combining the simplicity of Chat
Completions with the ability to do more agentic tasks. Azure OpenAI also
recently released the Responses API, with close-to feature parity with
OpenAI's SDK. It gives us enough to introduce an `AzureResponsesAgent`
and an `OpenAIResponsesAgent` to Semantic Kernel.

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

This PR introduces:
- The `AzureResponsesAgent` and `OpenAIResponsesAgent`
- Allows use of the web search tool with `OpenAI` (`Azure OpenAI`
currently doesn't support this).
- Allows use of the file search tool with both `OpenAI` and `Azure
OpenAI`.
- Provides getting started samples for both agent types.

**TODO:**
- Add unit test coverage for the `ResponsesAgentThreadActions` class.
- Add support for the computer user agent tool.
- Improve typing in the `ResponsesAgentThreadActions` class.
- Closes microsoft#11026

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [X] The code builds clean without any errors or warnings
- [X] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [X] All unit tests pass, and I have added new tests where possible
- [X] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents documentation python Pull requests for the Python Semantic Kernel
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Python: OpenAI Response Agent
4 participants