Skip to content

Agent Tool samples: web_search, code_interpreter, function_call, file_search and MCP#48109

Open
jpalvarezl wants to merge 24 commits intomainfrom
kayliee/feature/agents_tool_samples
Open

Agent Tool samples: web_search, code_interpreter, function_call, file_search and MCP#48109
jpalvarezl wants to merge 24 commits intomainfrom
kayliee/feature/agents_tool_samples

Conversation

@jpalvarezl
Copy link
Member

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:

  • Added CodeInterpreterAgent.java and CodeInterpreterAgentAsync.java samples to illustrate creating agents with the Code Interpreter tool and executing Python code both synchronously and asynchronously. [1] [2]
  • Added FileSearchAgent.java sample to demonstrate creating an agent with the File Search tool, uploading files, creating vector stores, and searching file content.

Client Builder Enhancements:

  • Introduced buildOpenAIClient() and buildOpenAIAsyncClient() methods in AgentsClientBuilder to simplify creation of OpenAI clients with default setup. [1] [2]

Parameter Naming Consistency:

  • Updated request parameter names from "agent" to "agent_reference" in both sync and async response creation methods for improved clarity and API consistency. [1] [2] [3] [4]

Copilot AI review requested due to automatic review settings February 25, 2026 13:54
@jpalvarezl jpalvarezl requested review from a team, dargilco and trrwilson as code owners February 25, 2026 13:54
@github-actions github-actions bot added the AI label Feb 25, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@github-actions
Copy link
Contributor

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-ai-agents

@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-ai-agents

@kaylieee kaylieee requested a review from glecaros as a code owner February 26, 2026 23:16
@kaylieee kaylieee self-requested a review as a code owner February 26, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants