Agent Tool samples: web_search, code_interpreter, function_call, file_search and MCP#48109
Open
jpalvarezl wants to merge 24 commits intomainfrom
Open
Agent Tool samples: web_search, code_interpreter, function_call, file_search and MCP#48109jpalvarezl wants to merge 24 commits intomainfrom
jpalvarezl wants to merge 24 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces comprehensive sample code demonstrating Azure AI Agent usage with various tools (Web Search, Code Interpreter, File Search, Function Call, and MCP), adds convenience methods to the AgentsClientBuilder for creating OpenAI clients, and updates parameter naming in the Response clients from "agent" to "agent_reference" for improved API consistency.
Changes:
- Added 9 new sample files demonstrating synchronous and asynchronous usage of Web Search, Code Interpreter, Function Call, and MCP tools, plus a File Search sample
- Enhanced AgentsClientBuilder with buildOpenAIClient() and buildOpenAIAsyncClient() methods to simplify OpenAI client creation
- Updated parameter names in ResponsesClient and ResponsesAsyncClient from "agent" to "agent_reference" to align with the AgentReference model's type field
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| WebSearchAgent.java | Synchronous Web Search tool sample |
| WebSearchAgentAsync.java | Asynchronous Web Search tool sample with incorrect JavaDoc |
| CodeInterpreterAgent.java | Synchronous Code Interpreter tool sample, missing serviceVersion |
| CodeInterpreterAgentAsync.java | Asynchronous Code Interpreter tool sample, missing serviceVersion |
| FunctionCallAgent.java | Synchronous Function Call tool sample |
| FunctionCallAgentAsync.java | Asynchronous Function Call tool sample |
| McpAgent.java | Synchronous MCP tool sample with misleading comment |
| McpAgentAsync.java | Asynchronous MCP tool sample with misleading comment and inconsistent timeout |
| FileSearchAgent.java | File Search tool sample with unused imports |
| ResponsesClient.java | Updated parameter name from "agent" to "agent_reference" |
| ResponsesAsyncClient.java | Updated parameter name from "agent" to "agent_reference" |
| AgentsClientBuilder.java | Added buildOpenAIClient() and buildOpenAIAsyncClient() methods |
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/tools/McpAgentAsync.java
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/FileSearchAgent.java
Outdated
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/tools/McpAgentAsync.java
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/tools/WebSearchAgent.java
Outdated
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/FileSearchAgent.java
Outdated
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/tools/WebSearchAgentAsync.java
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/tools/McpAgent.java
Show resolved
Hide resolved
...ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/tools/CodeInterpreterAgentAsync.java
Show resolved
Hide resolved
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/tools/CodeInterpreterAgent.java
Show resolved
Hide resolved
Contributor
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
Contributor
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
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.
This pull request introduces new sample code demonstrating Azure AI Agent usage with the Code Interpreter and File Search tools, and also refactors client builder and response parameter handling for improved OpenAI integration and consistency. The most important changes are grouped below by theme.
New Sample Code for Agent Tools:
CodeInterpreterAgent.javaandCodeInterpreterAgentAsync.javasamples to illustrate creating agents with the Code Interpreter tool and executing Python code both synchronously and asynchronously. [1] [2]FileSearchAgent.javasample to demonstrate creating an agent with the File Search tool, uploading files, creating vector stores, and searching file content.Client Builder Enhancements:
buildOpenAIClient()andbuildOpenAIAsyncClient()methods inAgentsClientBuilderto simplify creation of OpenAI clients with default setup. [1] [2]Parameter Naming Consistency:
"agent"to"agent_reference"in both sync and async response creation methods for improved clarity and API consistency. [1] [2] [3] [4]