Skip to content

Feat/OpenAI agent builtin tools 6657 #6671

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

tejas-dharani
Copy link
Contributor

@tejas-dharani tejas-dharani commented Jun 12, 2025

Why are these changes needed?

This PR adds comprehensive built-in tool support to OpenAIAgent, enabling support for file_search, code_interpreter, web_search_preview, computer_use_preview, image_generation, and mcp tools. The changes include comprehensive testing for all tool types including mixed usage scenarios, working examples demonstrating tool usage, updated documentation with version notes and usage examples, while maintaining backward compatibility with existing function tools.

Related issue number

Fixes #6657

Checks

…on guide- Fix version format from 0.4.0-dev-1 to 0.4.0-dev.1 for all packages- Remove reference to non-existent Microsoft.AutoGen.Extensions package- Add correct extension packages: Aspire, MEAI, and SemanticKernel- Fix typo: RuntimeGatewway -> RuntimeGateway- Improve documentation structure with clear section headersFixes microsoft#6244
Fix issue microsoft#6277 where TextMessage was used but not imported in three code cells
of the custom agents documentation, causing NameError when users run the examples.

Changes:
- Add TextMessage to imports in ArithmeticAgent section
- Add TextMessage to imports in GeminiAssistantAgent section
- Add TextMessage to imports in Declarative GeminiAssistantAgent section

The CountDownAgent section already had the correct import.

Fixes microsoft#6277
- Support file_search, code_interpreter, web_search_preview, computer_use_preview, image_generation, and mcp tools
- Add comprehensive tests for all tool types including mixed usage scenarios
- Include working examples demonstrating tool usage
- Update documentation with version notes and usage examples
- Maintain backward compatibility with existing function tools

Fixes microsoft#6657
@victordibia
Copy link
Collaborator

@withsmilo
Hi Sungjun,

Would you mid providing a first review here?

@withsmilo
Copy link
Contributor

Sure. Let me review today night.

Copy link

codecov bot commented Jun 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.69%. Comparing base (6e7415e) to head (e1e25ab).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6671      +/-   ##
==========================================
+ Coverage   79.67%   79.69%   +0.01%     
==========================================
  Files         231      231              
  Lines       17172    17188      +16     
==========================================
+ Hits        13682    13698      +16     
  Misses       3490     3490              
Flag Coverage Δ
unittests 79.69% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

dotnet add package Microsoft.AutoGen.AgentChat --version 0.4.0-dev-1
dotnet add package Microsoft.AutoGen.Agents --version 0.4.0-dev-1
dotnet add package Microsoft.AutoGen.Extensions --version 0.4.0-dev-1
dotnet add package Microsoft.AutoGen.AgentChat --version 0.4.0-dev.1
Copy link
Collaborator

@victordibia victordibia Jun 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tejas-dharani ,
Changes should be scoped to the PR title/focus
This file is unrelated to the OpenAI agent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @victordibia,
You're absolutely right - my apologies for the confusion.
My mistake was that after forking the repo, I raised my first PR (the .NET correction) directly from the main branch instead of creating a separate branch. After that, I created separate branches for all other issues, but now this .NET change is affecting every subsequent PR since they're all based off my modified main branch.
I understand this file is unrelated to the OpenAI agent work. I'll close the .NET PR to keep it separate from the OpenAI agent changes.
Thanks for catching this - lesson learned about proper Git workflow!

@@ -0,0 +1,231 @@
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, this file should be removed.
Please follow convention - examples should be in the docstrings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, Sure

Iterable[
Union[
Literal[
"file_search",
Copy link
Contributor

@withsmilo withsmilo Jun 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tejas-dharani .
According to the official doc, the Responses API supports 7 built-in tools as well as function calls. However, I found your PR omitted one built-in tool (local_shell) and lots of "required" parameters to execute built-in tools. Could you please check the official doc in detail once more?

  1. file_search

    1. vector_store_ids (required)
    2. filters
    3. max_num_results
    4. ranking_options
  2. web_search_preview

    1. search_context_size
    2. user_location
  3. computer_use_preview

    1. display_height (required)
    2. display_width (required)
    3. environment (required)
  4. mcp

    1. server_label (required)
    2. server_url (required)
    3. allowed_tools
    4. headers
    5. require_approval
  5. code_interpreter

    1. container (required)
  6. image_generation

    1. background
    2. input_image_mask
    3. ....
  7. local_shell

Copy link
Contributor Author

@tejas-dharani tejas-dharani Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @withsmilo,
Thank you for the detailed feedback! I missed required parameters for each tool type.

I'll address:
Implement all required parameters (vector_store_ids, display dimensions, container, server configs, etc.)
Add proper parameter validation and type hints
Fix the failing mypy/pyright checks

Will research the official docs more thoroughly for the complete specifications.
Thanks for the thorough review!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@withsmilo
I don't find the local_shell , are you refering to function calling ? Function calling is already there.
https://platform.openai.com/docs/guides/tools?api-mode=responses

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tejas-dharani , I compared the available tools present in the openai docs with the ones added in the PR. What I think @withsmilo is mentioning is that the local shell tool has not been implemented.

Copy link
Contributor Author

@tejas-dharani tejas-dharani Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, local shell tool is missing in Available tools openai docs.

Also Local shell is available through the Responses API for use with codex-mini-latest. It is not available on other models.

…stallation guide- Fix version format from 0.4.0-dev-1 to 0.4.0-dev.1 for all packages- Remove reference to non-existent Microsoft.AutoGen.Extensions package- Add correct extension packages: Aspire, MEAI, and SemanticKernel- Fix typo: RuntimeGatewway -> RuntimeGateway- Improve documentation structure with clear section headersFixes microsoft#6244"

This reverts commit 6d9fb2e.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAIAgent should support other tool types as well as function
4 participants