-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Generate from latest spec and deleteAgent customizations #48394
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,14 +8,14 @@ | |||||||
| import com.azure.ai.agents.implementation.models.CreateAgentRequest; | ||||||||
| import com.azure.ai.agents.implementation.models.CreateAgentVersionFromManifestRequest; | ||||||||
| import com.azure.ai.agents.implementation.models.CreateAgentVersionRequest; | ||||||||
| import com.azure.ai.agents.implementation.models.DeleteAgentResponse; | ||||||||
| import com.azure.ai.agents.implementation.models.UpdateAgentFromManifestRequest; | ||||||||
| import com.azure.ai.agents.implementation.models.UpdateAgentRequest; | ||||||||
| import com.azure.ai.agents.models.AgentDefinition; | ||||||||
| import com.azure.ai.agents.models.AgentDefinitionOptInKeys; | ||||||||
| import com.azure.ai.agents.models.AgentDetails; | ||||||||
| import com.azure.ai.agents.models.AgentKind; | ||||||||
| import com.azure.ai.agents.models.AgentVersionDetails; | ||||||||
| import com.azure.ai.agents.models.DeleteAgentResponse; | ||||||||
| import com.azure.ai.agents.models.DeleteAgentVersionResponse; | ||||||||
| import com.azure.ai.agents.models.PageOrder; | ||||||||
| import com.azure.core.annotation.Generated; | ||||||||
|
|
@@ -89,34 +89,6 @@ public Response<BinaryData> getAgentWithResponse(String agentName, RequestOption | |||||||
| return this.serviceClient.getAgentWithResponse(agentName, requestOptions); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Deletes an agent. | ||||||||
| * <p><strong>Response Body Schema</strong></p> | ||||||||
| * | ||||||||
| * <pre> | ||||||||
| * {@code | ||||||||
| * { | ||||||||
| * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required) | ||||||||
| * name: String (Required) | ||||||||
| * deleted: boolean (Required) | ||||||||
| * } | ||||||||
| * } | ||||||||
| * </pre> | ||||||||
| * | ||||||||
| * @param agentName The name of the agent to delete. | ||||||||
| * @param requestOptions The options to configure the HTTP request before HTTP client sends it. | ||||||||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||||||||
| * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. | ||||||||
| * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. | ||||||||
| * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. | ||||||||
| * @return a deleted agent Object along with {@link Response}. | ||||||||
| */ | ||||||||
| @Generated | ||||||||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||||||||
| public Response<BinaryData> deleteAgentWithResponse(String agentName, RequestOptions requestOptions) { | ||||||||
| return this.serviceClient.deleteAgentWithResponse(agentName, requestOptions); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Create a new agent version. | ||||||||
| * <p><strong>Header Parameters</strong></p> | ||||||||
|
|
@@ -301,26 +273,6 @@ public AgentDetails getAgent(String agentName) { | |||||||
| return getAgentWithResponse(agentName, requestOptions).getValue().toObject(AgentDetails.class); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Deletes an agent. | ||||||||
| * | ||||||||
| * @param agentName The name of the agent to delete. | ||||||||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||||||||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||||||||
| * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. | ||||||||
| * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. | ||||||||
| * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. | ||||||||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||||||||
| * @return a deleted agent Object. | ||||||||
| */ | ||||||||
| @Generated | ||||||||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||||||||
| public DeleteAgentResponse deleteAgent(String agentName) { | ||||||||
| // Generated convenience method for deleteAgentWithResponse | ||||||||
| RequestOptions requestOptions = new RequestOptions(); | ||||||||
| return deleteAgentWithResponse(agentName, requestOptions).getValue().toObject(DeleteAgentResponse.class); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Returns the list of all agents. | ||||||||
| * | ||||||||
|
|
@@ -1364,4 +1316,69 @@ public AgentVersionDetails createAgentVersion(String agentName, AgentDefinition | |||||||
| return createAgentVersionWithResponse(agentName, createAgentVersionRequest, requestOptions).getValue() | ||||||||
| .toObject(AgentVersionDetails.class); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Deletes an agent. | ||||||||
| * | ||||||||
| * @param agentName The name of the agent to delete. | ||||||||
| * @throws IllegalArgumentException thrown if parameters fail the validation. | ||||||||
| * @throws HttpResponseException thrown if the request is rejected by server. | ||||||||
| * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. | ||||||||
| * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. | ||||||||
| * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. | ||||||||
| * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||||||||
| */ | ||||||||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||||||||
| public void deleteAgent(String agentName) { | ||||||||
| internalDeleteAgent(agentName); | ||||||||
|
||||||||
| internalDeleteAgent(agentName); | |
| RequestOptions requestOptions = new RequestOptions(); | |
| internalDeleteAgentWithResponse(agentName, requestOptions); |
Copilot
AI
Mar 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API change (making AgentsClient.deleteAgent return void and removing DeleteAgentResponse from the public models package) breaks in-repo usages that still expect DeleteAgentResponse (for example the DeleteAgent sample and AgentsTests). Those call sites need to be updated to call deleteAgent(...) without capturing a return value (and to stop importing com.azure.ai.agents.models.DeleteAgentResponse).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AgentsAsyncClient.deleteAgentdelegates tointernalDeleteAgent(agentName).then(), which still deserializes the delete response intoDeleteAgentResponseeven though the public API returnsMono<Void>. To reduce overhead and avoid coupling to the response body, consider delegating tointernalDeleteAgentWithResponse(agentName, requestOptions).then()(or otherwise avoiding thetoObject(DeleteAgentResponse.class)step).