Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
193f1ec
re emit
kaylieee May 12, 2026
420fcf5
suppress spellcheck for dedup
kaylieee May 12, 2026
8c961ff
add checkstyle suppressions
kaylieee May 13, 2026
2f2fcdb
rename targetconfig
kaylieee May 13, 2026
8b3e811
add custom overload
kaylieee May 13, 2026
8214549
Merge branch 'main' into kaylieee/release/2.1.0
kaylieee May 13, 2026
3eac3e7
unhide tsp location
kaylieee May 13, 2026
5e78999
regen
kaylieee May 13, 2026
7a03a9b
add customization for union type
kaylieee May 13, 2026
20283c6
Merge branch 'main' into kaylieee/release/2.1.0
kaylieee May 13, 2026
950bf72
increment versions
kaylieee May 13, 2026
22239bd
fix spacing
kaylieee May 13, 2026
560aec6
regen
kaylieee May 13, 2026
2b02d3e
regen
kaylieee May 15, 2026
fbd71c5
fix spacing
kaylieee May 15, 2026
bd44689
suppress checkstyle
kaylieee May 18, 2026
41792a3
Merge branch 'main' into kaylieee/release/2.1.0
kaylieee May 18, 2026
325c4ac
add listAgentConversations overload
kaylieee May 19, 2026
23106c4
Tests and Samples for 2.1.0 release (#49167)
jpalvarezl May 19, 2026
e84ca83
update samples and tests
kaylieee May 19, 2026
d173b3a
getSessionFiles rename
kaylieee May 19, 2026
fdd06d1
fix async sample
kaylieee May 19, 2026
ab49517
Move evaluator generation ops (#49238)
kaylieee May 21, 2026
4a9a550
Merge branch 'main' into kaylieee/release/2.1.0
kaylieee May 21, 2026
1f1f676
Emit agent optimizations (#49240)
kaylieee May 21, 2026
4b95ebc
update sessionlog tests
kaylieee May 21, 2026
2208496
revert version to beta.2
kaylieee May 21, 2026
6d2da66
update version client txt
kaylieee May 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,142 changes: 928 additions & 214 deletions sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClient.java

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

import com.azure.ai.agents.models.AgentCard;
import com.azure.ai.agents.models.AgentCardSkill;
import com.azure.ai.agents.models.AgentEndpoint;
import com.azure.ai.agents.models.AgentEndpointAuthorizationScheme;
import com.azure.ai.agents.models.IsolationKeySource;
import com.azure.ai.agents.models.AgentEndpointConfig;
import com.azure.ai.agents.models.UpdateAgentDetailsOptions;
import com.azure.ai.agents.models.VersionSelectionRule;
import com.azure.ai.agents.models.VersionSelector;
Expand All @@ -17,20 +16,21 @@
* This is the Helper class to enable json merge patch serialization for a model.
*/
public class JsonMergePatchHelper {
private static AgentEndpointAccessor agentEndpointAccessor;
private static AgentEndpointConfigAccessor agentEndpointConfigAccessor;

public interface AgentEndpointAccessor {
AgentEndpoint prepareModelForJsonMergePatch(AgentEndpoint agentEndpoint, boolean jsonMergePatchEnabled);
public interface AgentEndpointConfigAccessor {
AgentEndpointConfig prepareModelForJsonMergePatch(AgentEndpointConfig agentEndpointConfig,
boolean jsonMergePatchEnabled);

boolean isJsonMergePatch(AgentEndpoint agentEndpoint);
boolean isJsonMergePatch(AgentEndpointConfig agentEndpointConfig);
}

public static void setAgentEndpointAccessor(AgentEndpointAccessor accessor) {
agentEndpointAccessor = accessor;
public static void setAgentEndpointConfigAccessor(AgentEndpointConfigAccessor accessor) {
agentEndpointConfigAccessor = accessor;
}

public static AgentEndpointAccessor getAgentEndpointAccessor() {
return agentEndpointAccessor;
public static AgentEndpointConfigAccessor getAgentEndpointConfigAccessor() {
return agentEndpointConfigAccessor;
}

private static VersionSelectorAccessor versionSelectorAccessor;
Expand Down Expand Up @@ -85,23 +85,6 @@ public static AgentEndpointAuthorizationSchemeAccessor getAgentEndpointAuthoriza
return agentEndpointAuthorizationSchemeAccessor;
}

private static IsolationKeySourceAccessor isolationKeySourceAccessor;

public interface IsolationKeySourceAccessor {
IsolationKeySource prepareModelForJsonMergePatch(IsolationKeySource isolationKeySource,
boolean jsonMergePatchEnabled);

boolean isJsonMergePatch(IsolationKeySource isolationKeySource);
}

public static void setIsolationKeySourceAccessor(IsolationKeySourceAccessor accessor) {
isolationKeySourceAccessor = accessor;
}

public static IsolationKeySourceAccessor getIsolationKeySourceAccessor() {
return isolationKeySourceAccessor;
}

private static AgentCardAccessor agentCardAccessor;

public interface AgentCardAccessor {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.ai.agents.implementation;

import com.azure.core.http.HttpHeaderName;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.util.BinaryData;
import com.azure.core.util.CoreUtils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.SequenceInputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.UUID;

// DO NOT modify this helper class

public final class MultipartFormDataHelper {
/**
* Line separator for the multipart HTTP request.
*/
private static final String CRLF = "\r\n";

private static final String APPLICATION_OCTET_STREAM = "application/octet-stream";

/**
* Value to be used as part of the divider for the multipart requests.
*/
private final String boundary;

/**
* The actual part separator in the request. This is obtained by prepending "--" to the "boundary".
*/
private final String partSeparator;

/**
* The marker for the ending of a multipart request. This is obtained by post-pending "--" to the "partSeparator".
*/
private final String endMarker;

/**
* Charset used for encoding the multipart HTTP request.
*/
private final Charset encoderCharset = StandardCharsets.UTF_8;

private InputStream requestDataStream = new ByteArrayInputStream(new byte[0]);
private long requestLength = 0;

private RequestOptions requestOptions;
private BinaryData requestBody;

/**
* Default constructor used in the code. The boundary is a random value.
*
* @param requestOptions the RequestOptions to update
*/
public MultipartFormDataHelper(RequestOptions requestOptions) {
this(requestOptions, UUID.randomUUID().toString().substring(0, 16));
}

private MultipartFormDataHelper(RequestOptions requestOptions, String boundary) {
this.requestOptions = requestOptions;
this.boundary = boundary;
this.partSeparator = "--" + boundary;
this.endMarker = this.partSeparator + "--";
}

/**
* Gets the multipart HTTP request body.
*
* @return the BinaryData of the multipart HTTP request body
*/
public BinaryData getRequestBody() {
return requestBody;
}

// text/plain
/**
* Formats a text/plain field for a multipart HTTP request.
*
* @param fieldName the field name
* @param value the value of the text/plain field
* @return the MultipartFormDataHelper instance
*/
public MultipartFormDataHelper serializeTextField(String fieldName, String value) {
if (value != null) {
String serialized = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName)
+ "\"" + CRLF + CRLF + value + CRLF;
byte[] data = serialized.getBytes(encoderCharset);
appendBytes(data);
}
return this;
}

// application/json
/**
* Formats a application/json field for a multipart HTTP request.
*
* @param fieldName the field name
* @param jsonObject the object of the application/json field
* @return the MultipartFormDataHelper instance
*/
public MultipartFormDataHelper serializeJsonField(String fieldName, Object jsonObject) {
if (jsonObject != null) {
String serialized
= partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + CRLF
+ "Content-Type: application/json" + CRLF + CRLF + BinaryData.fromObject(jsonObject) + CRLF;
byte[] data = serialized.getBytes(encoderCharset);
appendBytes(data);
}
return this;
}

/**
* Formats a file field for a multipart HTTP request.
*
* @param fieldName the field name
* @param file the BinaryData of the file
* @param contentType the content-type of the file
* @param filename the filename
* @return the MultipartFormDataHelper instance
*/
public MultipartFormDataHelper serializeFileField(String fieldName, BinaryData file, String contentType,
String filename) {
if (file != null) {
if (CoreUtils.isNullOrEmpty(contentType)) {
contentType = APPLICATION_OCTET_STREAM;
}
writeFileField(fieldName, file, contentType, filename);
}
return this;
}

/**
* Formats a file field (potentially multiple files) for a multipart HTTP request.
*
* @param fieldName the field name
* @param files the List of BinaryData of the files
* @param contentTypes the List of content-type of the files
* @param filenames the List of filenames
* @return the MultipartFormDataHelper instance
*/
public MultipartFormDataHelper serializeFileFields(String fieldName, List<BinaryData> files,
List<String> contentTypes, List<String> filenames) {
if (files != null) {
for (int i = 0; i < files.size(); ++i) {
BinaryData file = files.get(i);
String contentType = contentTypes.get(i);
if (CoreUtils.isNullOrEmpty(contentType)) {
contentType = APPLICATION_OCTET_STREAM;
}
String filename = filenames.get(i);
writeFileField(fieldName, file, contentType, filename);
}
}
return this;
}

/**
* Ends the serialization of the multipart HTTP request.
*
* @return the MultipartFormDataHelper instance
*/
public MultipartFormDataHelper end() {
byte[] data = endMarker.getBytes(encoderCharset);
appendBytes(data);

requestBody = BinaryData.fromStream(requestDataStream, requestLength);

requestOptions.setHeader(HttpHeaderName.CONTENT_TYPE, "multipart/form-data; boundary=" + this.boundary)
.setHeader(HttpHeaderName.CONTENT_LENGTH, String.valueOf(requestLength));

return this;
}

private void writeFileField(String fieldName, BinaryData file, String contentType, String filename) {
String contentDispositionFilename = "";
if (!CoreUtils.isNullOrEmpty(filename)) {
contentDispositionFilename = "; filename=\"" + escapeName(filename) + "\"";
}

// Multipart preamble
String fileFieldPreamble
= partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\""
+ contentDispositionFilename + CRLF + "Content-Type: " + contentType + CRLF + CRLF;
byte[] data = fileFieldPreamble.getBytes(encoderCharset);
appendBytes(data);

// Writing the file into the request as a byte stream
requestLength += file.getLength();
requestDataStream = new SequenceInputStream(requestDataStream, file.toStream());

// CRLF
data = CRLF.getBytes(encoderCharset);
appendBytes(data);
}

private void appendBytes(byte[] bytes) {
requestLength += bytes.length;
requestDataStream = new SequenceInputStream(requestDataStream, new ByteArrayInputStream(bytes));
}

private static String escapeName(String name) {
return name.replace("\n", "%0A").replace("\r", "%0D").replace("\"", "%22");
}
}
Loading
Loading