diff --git a/sdk/ai/azure-ai-agents/README.md b/sdk/ai/azure-ai-agents/README.md
index 2544635cdd04..d425968263d0 100644
--- a/sdk/ai/azure-ai-agents/README.md
+++ b/sdk/ai/azure-ai-agents/README.md
@@ -723,7 +723,7 @@ The synchronous session log method returns `IterableStream`, wh
```java com.azure.ai.agents.session_logs_sync
IterableStream sessionLogs =
- betaAgentsClient.getSessionLogStream(agentName, agentVersion, sessionId);
+ agentsClient.getSessionLogStream(agentName, agentVersion, sessionId);
int logsRead = 0;
for (SessionLogEvent event : sessionLogs) {
@@ -741,7 +741,7 @@ for (SessionLogEvent event : sessionLogs) {
The asynchronous session log method returns `Flux`, integrating naturally with Reactor pipelines:
```java com.azure.ai.agents.session_logs_async
-betaAgentsAsyncClient.getSessionLogStream(agentName, agentVersion, sessionId)
+agentsAsyncClient.getSessionLogStream(agentName, agentVersion, sessionId)
.take(100)
.doOnNext(event -> System.out.printf("[%s] %s%n", event.getEvent(), event.getData()))
.blockLast();
diff --git a/sdk/ai/azure-ai-agents/cspell.yaml b/sdk/ai/azure-ai-agents/cspell.yaml
index a672340aa170..e5c1988ca2e6 100644
--- a/sdk/ai/azure-ai-agents/cspell.yaml
+++ b/sdk/ai/azure-ai-agents/cspell.yaml
@@ -3,6 +3,7 @@ import:
overrides:
- filename: "**/sdk/ai/azure-ai-agents/*"
words:
+ - BYOT
- dedup
- gitmcp
- byot
diff --git a/sdk/ai/azure-ai-agents/customizations/beta-annotations.csv b/sdk/ai/azure-ai-agents/customizations/beta-annotations.csv
index f174b7a578cf..203df3be166c 100644
--- a/sdk/ai/azure-ai-agents/customizations/beta-annotations.csv
+++ b/sdk/ai/azure-ai-agents/customizations/beta-annotations.csv
@@ -1,50 +1,8 @@
type;class_name;annotation_description;member_name
-class;com.azure.ai.agents.implementation.models.CreateAgentFromCodeContent;Preview API. CodeAgents=V1Preview;
-class;com.azure.ai.agents.models.AgentBlueprintReference;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentBlueprintReferenceType;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentCard;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentCardSkill;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentDefinition;Preview API. CodeAgents=V1Preview, ExternalAgents=V1Preview, HostedAgents=V1Preview, WorkflowAgents=V1Preview;
-field;com.azure.ai.agents.models.AgentDetails;Preview API. AgentEndpoints=V1Preview;agent_card
-field;com.azure.ai.agents.models.AgentDetails;Preview API. AgentEndpoints=V1Preview;agent_endpoint
-field;com.azure.ai.agents.models.AgentDetails;Preview API. AgentEndpoints=V1Preview;blueprint_reference
-field;com.azure.ai.agents.models.AgentDetails;Preview API. AgentEndpoints=V1Preview;blueprintIdentity
-field;com.azure.ai.agents.models.AgentDetails;Preview API. AgentEndpoints=V1Preview;instance_identity
-class;com.azure.ai.agents.models.AgentEndpointAuthorizationScheme;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentEndpointAuthorizationSchemeType;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentEndpointConfig;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentIdentifier;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.AgentIdentity;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentSessionResource;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.AgentSessionStatus;Preview API. AgentEndpoints=V1Preview;
-field;com.azure.ai.agents.models.AgentVersionDetails;Preview API. AgentEndpoints=V1Preview;agent_guid
-field;com.azure.ai.agents.models.AgentVersionDetails;Preview API. AgentEndpoints=V1Preview;blueprint
-field;com.azure.ai.agents.models.AgentVersionDetails;Preview API. AgentEndpoints=V1Preview;blueprint_reference
-field;com.azure.ai.agents.models.AgentVersionDetails;Preview API. AgentEndpoints=V1Preview;instance_identity
-class;com.azure.ai.agents.models.BotServiceAuthorizationScheme;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.BotServiceRbacAuthorizationScheme;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.CandidateDeployConfig;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.CandidateFileInfo;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.CandidateMetadata;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.CandidateResults;Preview API. AgentsOptimization=V1Preview;
+class;com.azure.ai.agents.models.AgentDefinition;Preview API. ExternalAgents=V1Preview, WorkflowAgents=V1Preview;
class;com.azure.ai.agents.models.ChatSummaryMemoryItem;Preview API. MemoryStores=V1Preview;
-class;com.azure.ai.agents.models.CodeConfiguration;Preview API. CodeAgents=V1Preview;
-class;com.azure.ai.agents.models.ContainerConfiguration;Preview API. CodeAgents=V1Preview;
-class;com.azure.ai.agents.models.CreateAgentVersionFromCodeContent;Preview API. CodeAgents=V1Preview;
-class;com.azure.ai.agents.models.CreateAgentVersionFromCodeMetadata;Preview API. CodeAgents=V1Preview;
-class;com.azure.ai.agents.models.CreateAgentVersionInput;Preview API. CodeAgents=V1Preview, ExternalAgents=V1Preview, HostedAgents=V1Preview, WorkflowAgents=V1Preview;
-class;com.azure.ai.agents.models.DatasetInfo;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.DatasetRef;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.EntraAuthorizationScheme;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.EntraIsolationKeySource;Preview API. AgentEndpoints=V1Preview;
+class;com.azure.ai.agents.models.CreateAgentVersionInput;Preview API. ExternalAgents=V1Preview, WorkflowAgents=V1Preview;
class;com.azure.ai.agents.models.ExternalAgentDefinition;Preview API. ExternalAgents=V1Preview;
-class;com.azure.ai.agents.models.FixedRatioVersionSelectionRule;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.HeaderIsolationKeySource;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.HeaderTelemetryEndpointAuth;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.HostedAgentDefinition;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.IsolationKeySource;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.IsolationKeySourceKind;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.ManagedAgentIdentityBlueprintReference;Preview API. AgentEndpoints=V1Preview;
class;com.azure.ai.agents.models.MemoryItem;Preview API. MemoryStores=V1Preview;
class;com.azure.ai.agents.models.MemoryItemKind;Preview API. MemoryStores=V1Preview;
class;com.azure.ai.agents.models.MemoryOperation;Preview API. MemoryStores=V1Preview;
@@ -61,33 +19,21 @@ class;com.azure.ai.agents.models.MemoryStoreSearchResponse;Preview API. MemorySt
class;com.azure.ai.agents.models.MemoryStoreUpdateCompletedResult;Preview API. MemoryStores=V1Preview;
class;com.azure.ai.agents.models.MemoryStoreUpdateResponse;Preview API. MemoryStores=V1Preview;
class;com.azure.ai.agents.models.MemoryStoreUpdateStatus;Preview API. MemoryStores=V1Preview;
-class;com.azure.ai.agents.models.OptimizationAgentDefinition;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.OptimizationCandidate;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.OptimizationJob;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.OptimizationJobInputs;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.OptimizationJobProgress;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.OptimizationJobResult;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.OptimizationOptions;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.OptimizationTaskResult;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.OtlpTelemetryEndpoint;Preview API. HostedAgents=V1Preview;
+class;com.azure.ai.agents.models.OptimizationAgentIdentifier;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationCandidate;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationDatasetCriterion;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationDatasetInput;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationDatasetItem;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationEvaluatorRef;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationInlineDatasetInput;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationJob;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationJobInputs;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationJobListItem;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationJobProgress;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationJobResult;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationOptions;Preview API. AgentsOptimization=V2Preview;
+class;com.azure.ai.agents.models.OptimizationReferenceDatasetInput;Preview API. AgentsOptimization=V2Preview;
class;com.azure.ai.agents.models.ProceduralMemoryItem;Preview API. MemoryStores=V1Preview;
-class;com.azure.ai.agents.models.PromoteCandidateInput;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.PromoteCandidateResult;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.PromotionInfo;Preview API. AgentsOptimization=V1Preview;
-class;com.azure.ai.agents.models.SessionLogEvent;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.SessionLogEventType;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.TelemetryConfig;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.TelemetryDataKind;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.TelemetryEndpoint;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.TelemetryEndpointAuth;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.TelemetryEndpointAuthType;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.TelemetryEndpointKind;Preview API. HostedAgents=V1Preview;
-class;com.azure.ai.agents.models.TelemetryTransportProtocol;Preview API. HostedAgents=V1Preview;
+class;com.azure.ai.agents.models.PromotionInfo;Preview API. AgentsOptimization=V2Preview;
class;com.azure.ai.agents.models.UserProfileMemoryItem;Preview API. MemoryStores=V1Preview;
-class;com.azure.ai.agents.models.VersionIndicator;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.VersionIndicatorType;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.VersionRefIndicator;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.VersionSelectionRule;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.VersionSelector;Preview API. AgentEndpoints=V1Preview;
-class;com.azure.ai.agents.models.VersionSelectorType;Preview API. AgentEndpoints=V1Preview;
class;com.azure.ai.agents.models.WorkflowAgentDefinition;Preview API. WorkflowAgents=V1Preview;
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsAsyncClient.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsAsyncClient.java
index 957ddb00e6b0..d428919c296a 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsAsyncClient.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsAsyncClient.java
@@ -4,20 +4,32 @@
package com.azure.ai.agents;
import com.azure.ai.agents.implementation.AgentsImpl;
+import com.azure.ai.agents.implementation.JsonMergePatchHelper;
+import com.azure.ai.agents.implementation.MultipartFormDataHelper;
+import com.azure.ai.agents.implementation.SessionLogStreamHelper;
+import com.azure.ai.agents.implementation.models.CreateAgentFromCodeContent;
import com.azure.ai.agents.implementation.models.CreateAgentFromManifestRequest;
import com.azure.ai.agents.implementation.models.CreateAgentOptions;
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.CreateSessionRequest;
import com.azure.ai.agents.implementation.models.UpdateAgentFromManifestRequest;
import com.azure.ai.agents.implementation.models.UpdateAgentRequest;
import com.azure.ai.agents.models.AgentBlueprintReference;
import com.azure.ai.agents.models.AgentDefinition;
import com.azure.ai.agents.models.AgentDetails;
import com.azure.ai.agents.models.AgentKind;
+import com.azure.ai.agents.models.AgentSessionResource;
import com.azure.ai.agents.models.AgentVersionDetails;
+import com.azure.ai.agents.models.CreateAgentVersionFromCodeContent;
import com.azure.ai.agents.models.CreateAgentVersionInput;
import com.azure.ai.agents.models.PageOrder;
+import com.azure.ai.agents.models.SessionDirectoryEntry;
+import com.azure.ai.agents.models.SessionFileWriteResult;
+import com.azure.ai.agents.models.SessionLogEvent;
+import com.azure.ai.agents.models.UpdateAgentDetailsOptions;
+import com.azure.ai.agents.models.VersionIndicator;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
@@ -62,6 +74,7 @@ public final class AgentsAsyncClient {
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -483,6 +496,7 @@ public Mono createAgentVersion(String agentName, AgentDefin
* {@code
* {
* name: String (Required)
+ * state: String(enabled/disabled) (Optional)
* metadata (Optional): {
* String: String (Required)
* }
@@ -543,6 +557,7 @@ public Mono createAgentVersion(String agentName, AgentDefin
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -663,6 +678,7 @@ Mono> createAgentWithResponse(BinaryData createAgentRequest
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -817,6 +833,7 @@ Mono updateAgent(String agentName, AgentDefinition definition) {
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -934,6 +951,7 @@ Mono> createAgentFromManifestWithResponse(BinaryData create
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1512,6 +1530,7 @@ public PagedFlux listAgentVersions(String agentName, Intege
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1885,7 +1904,8 @@ Mono createAgent(CreateAgentOptions options) {
// Generated convenience method for createAgentWithResponse
RequestOptions requestOptions = new RequestOptions();
CreateAgentRequest createAgentRequestObj
- = new CreateAgentRequest(options.getAgentName(), options.getDefinition()).setMetadata(options.getMetadata())
+ = new CreateAgentRequest(options.getAgentName(), options.getDefinition()).setState(options.getState())
+ .setMetadata(options.getMetadata())
.setDescription(options.getDescription())
.setBlueprintReference(options.getBlueprintReference())
.setAgentEndpoint(options.getAgentEndpoint())
@@ -2130,4 +2150,1890 @@ Mono updateAgent(String agentName, AgentDefinition definition, Map
return updateAgentWithResponse(agentName, updateAgentRequest, requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(AgentDetails.class));
}
+
+ /**
+ * Create a new code-based agent
+ *
+ * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
+ * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
+ * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * state: String(enabled/disabled) (Required)
+ * versions (Required): {
+ * latest (Required): {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
+ * }
+ * }
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * instance_identity (Optional): (recursive schema, see instance_identity above)
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
+ * hyphens allowed in the middle.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Mono> createAgentFromCodeWithResponse(String agentName, String codeZipSha256,
+ BinaryData content, RequestOptions requestOptions) {
+ // Operation 'createAgentFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable and
+ // hence not generated.
+ return this.serviceClient.createAgentFromCodeWithResponseAsync(agentName, codeZipSha256, content,
+ requestOptions);
+ }
+
+ /**
+ * Update a code-based agent
+ *
+ * Updates a code-based agent by uploading new code and creating a new version.
+ * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * state: String(enabled/disabled) (Required)
+ * versions (Required): {
+ * latest (Required): {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
+ * }
+ * }
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * instance_identity (Optional): (recursive schema, see instance_identity above)
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Mono> updateAgentFromCodeWithResponse(String agentName, String codeZipSha256,
+ BinaryData content, RequestOptions requestOptions) {
+ // Operation 'updateAgentFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable and
+ // hence not generated.
+ return this.serviceClient.updateAgentFromCodeWithResponseAsync(agentName, codeZipSha256, content,
+ requestOptions);
+ }
+
+ /**
+ * Update an agent endpoint
+ *
+ * Applies a merge-patch update to the specified agent endpoint configuration.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * state: String(enabled/disabled) (Required)
+ * versions (Required): {
+ * latest (Required): {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
+ * }
+ * }
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * instance_identity (Optional): (recursive schema, see instance_identity above)
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent to retrieve
+ *
+ * The name of the agent to retrieve.
+ * @param patchAgentObjectRequest The patchAgentObjectRequest parameter.
+ * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateAgentDetailsWithResponse(String agentName,
+ BinaryData patchAgentObjectRequest, RequestOptions requestOptions) {
+ return this.serviceClient.updateAgentDetailsWithResponseAsync(agentName, patchAgentObjectRequest,
+ requestOptions);
+ }
+
+ /**
+ * Create an agent version from code
+ *
+ * Creates a new agent version from code. Uploads the code zip and creates a new version
+ * for an existing agent. The SHA-256 hex digest of the zip is provided in the
+ * `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
+ * }
+ * }
+ *
+ *
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Mono> createAgentVersionFromCodeWithResponse(String agentName, String codeZipSha256,
+ BinaryData content, RequestOptions requestOptions) {
+ // Operation 'createAgentVersionFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable
+ // and hence not generated.
+ return this.serviceClient.createAgentVersionFromCodeWithResponseAsync(agentName, codeZipSha256, content,
+ requestOptions);
+ }
+
+ /**
+ * Download agent code
+ *
+ * Downloads the code zip for a code-based hosted agent.
+ * Returns the previously-uploaded zip (`application/zip`).
+ *
+ * If `agent_version` is supplied, returns that version's code zip; otherwise
+ * returns the latest version's code zip.
+ *
+ * The SHA-256 digest of the returned bytes matches the `content_hash` on the
+ * resolved version's `code_configuration`.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | agent_version | String | No | The version of the agent whose code zip should be
+ * downloaded.
+ * If omitted, the latest version's code zip is returned. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * BinaryData
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> downloadAgentCodeWithResponse(String agentName, RequestOptions requestOptions) {
+ return this.serviceClient.downloadAgentCodeWithResponseAsync(agentName, requestOptions);
+ }
+
+ /**
+ * Create a session
+ *
+ * Creates a new session for an agent endpoint.
+ * The endpoint resolves the backing agent version from `version_indicator` and
+ * enforces session ownership using the provided isolation key for session-mutating operations.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_session_id: String (Optional)
+ * version_indicator (Required): {
+ * type: String(version_ref) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_session_id: String (Required)
+ * version_indicator (Required): {
+ * type: String(version_ref) (Required)
+ * }
+ * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
+ * created_at: long (Required)
+ * last_accessed_at: long (Required)
+ * expires_at: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent to create a session for.
+ * @param createSessionRequest The createSessionRequest parameter.
+ * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createSessionWithResponse(String agentName, BinaryData createSessionRequest,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createSessionWithResponseAsync(agentName, createSessionRequest, requestOptions);
+ }
+
+ /**
+ * Get a session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_session_id: String (Required)
+ * version_indicator (Required): {
+ * type: String(version_ref) (Required)
+ * }
+ * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
+ * created_at: long (Required)
+ * last_accessed_at: long (Required)
+ * expires_at: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier along with {@link Response}
+ * on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getSessionWithResponse(String agentName, String sessionId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getSessionWithResponseAsync(agentName, sessionId, requestOptions);
+ }
+
+ /**
+ * Delete a session
+ *
+ * Deletes a session synchronously.
+ * Returns 204 No Content when the session is deleted or does not exist.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 the {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteSessionWithResponse(String agentName, String sessionId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.deleteSessionWithResponseAsync(agentName, sessionId, requestOptions);
+ }
+
+ /**
+ * Stop a session
+ *
+ * Terminates the specified hosted agent session and returns 204 No Content when the request succeeds.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 the {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> stopSessionWithResponse(String agentName, String sessionId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.stopSessionWithResponseAsync(agentName, sessionId, requestOptions);
+ }
+
+ /**
+ * List sessions for an agent
+ *
+ * Returns a paged collection of sessions associated with the specified agent endpoint.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
+ * between 1 and 100, and the
+ * default is 20. |
+ * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
+ * for ascending order and`desc`
+ * for descending order. Allowed values: "asc", "desc". |
+ * | after | String | No | A cursor for use in pagination. `after` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
+ * | before | String | No | A cursor for use in pagination. `before` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_session_id: String (Required)
+ * version_indicator (Required): {
+ * type: String(version_ref) (Required)
+ * }
+ * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
+ * created_at: long (Required)
+ * last_accessed_at: long (Required)
+ * expires_at: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listSessions(String agentName, RequestOptions requestOptions) {
+ return this.serviceClient.listSessionsAsync(agentName, requestOptions);
+ }
+
+ /**
+ * Stream console logs for a hosted agent session
+ *
+ * Streams console logs (stdout / stderr) for a specific hosted agent session
+ * as a Server-Sent Events (SSE) stream.
+ *
+ * Each SSE frame contains:
+ * - `event`: always `"log"`
+ * - `data`: a plain-text log line (currently JSON-formatted, but the schema
+ * is not contractual and may include additional keys or change format
+ * over time — clients should treat it as an opaque string)
+ *
+ * Example SSE frames:
+ * ```
+ * event: log
+ * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port
+ * 8088"}
+ *
+ * event: log
+ * data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."}
+ *
+ * event: log
+ * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"}
+ *
+ * event: log
+ * data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"}
+ * ```
+ *
+ * The stream remains open until the client disconnects or the server
+ * terminates the connection. Clients should handle reconnection as needed.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * event: String(log) (Required)
+ * data: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the hosted agent.
+ * @param agentVersion The version of the agent.
+ * @param sessionId The session ID (maps to an ADC sandbox).
+ * @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 single Server-Sent Event frame emitted by the hosted agent session log stream.
+ *
+ * Each frame contains an `event` field identifying the event type and a `data`
+ * field carrying the payload as plain text along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getSessionLogStreamWithResponse(String agentName, String agentVersion,
+ String sessionId, RequestOptions requestOptions) {
+ return this.serviceClient.getSessionLogStreamWithResponseAsync(agentName, agentVersion, sessionId,
+ requestOptions);
+ }
+
+ /**
+ * Upload a session file
+ *
+ * Uploads binary file content to the specified path in the session sandbox.
+ * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * BinaryData
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * path: String (Required)
+ * bytes_written: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The destination file path within the sandbox, relative to the session home directory.
+ * @param content The content parameter.
+ * @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 response from uploading a file to a session sandbox along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> uploadSessionFileWithResponse(String agentName, String agentSessionId,
+ String path, BinaryData content, RequestOptions requestOptions) {
+ return this.serviceClient.uploadSessionFileWithResponseAsync(agentName, agentSessionId, path, content,
+ requestOptions);
+ }
+
+ /**
+ * Download a session file
+ *
+ * Downloads the file at the specified sandbox path as a binary stream.
+ * The path is resolved relative to the session home directory.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * BinaryData
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file path to download from the sandbox, relative to the session home directory.
+ * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> downloadSessionFileWithResponse(String agentName, String agentSessionId,
+ String path, RequestOptions requestOptions) {
+ return this.serviceClient.downloadSessionFileWithResponseAsync(agentName, agentSessionId, path, requestOptions);
+ }
+
+ /**
+ * List session files
+ *
+ * Returns files and directories at the specified path in the session sandbox.
+ * The response includes only the immediate children of the target directory and defaults to the session home
+ * directory when no path is supplied.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | path | String | No | The directory path to list, relative to the session home
+ * directory. Defaults to the home directory if not provided. |
+ * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
+ * between 1 and 100, and the
+ * default is 20. |
+ * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
+ * for ascending order and`desc`
+ * for descending order. Allowed values: "asc", "desc". |
+ * | after | String | No | A cursor for use in pagination. `after` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
+ * | before | String | No | A cursor for use in pagination. `before` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * size: long (Required)
+ * is_directory: boolean (Required)
+ * modified_time: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @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 the paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listSessionFiles(String agentName, String agentSessionId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listSessionFilesAsync(agentName, agentSessionId, requestOptions);
+ }
+
+ /**
+ * Delete a session file
+ *
+ * Deletes the specified file or directory from the session sandbox.
+ * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | recursive | Boolean | No | Whether to recursively delete directory contents. The
+ * service defaults to `false` if a value is not specified by the caller. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file or directory path to delete, relative to the session home directory.
+ * @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 the {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> deleteSessionFileWithResponse(String agentName, String agentSessionId, String path,
+ RequestOptions requestOptions) {
+ return this.serviceClient.deleteSessionFileWithResponseAsync(agentName, agentSessionId, path, requestOptions);
+ }
+
+ /**
+ * Create a new code-based agent
+ *
+ * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
+ * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
+ * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ *
+ * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
+ * hyphens allowed in the middle.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Mono createAgentFromCode(String agentName, String codeZipSha256, CreateAgentFromCodeContent content) {
+ // Generated convenience method for createAgentFromCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createAgentFromCodeWithResponse(agentName, codeZipSha256,
+ new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
+ .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
+ content.getCode().getFilename())
+ .end()
+ .getRequestBody(),
+ requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentDetails.class));
+ }
+
+ /**
+ * Update a code-based agent
+ *
+ * Updates a code-based agent by uploading new code and creating a new version.
+ * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ *
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateAgentFromCode(String agentName, String codeZipSha256,
+ CreateAgentVersionFromCodeContent content) {
+ // Generated convenience method for updateAgentFromCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return updateAgentFromCodeWithResponse(agentName, codeZipSha256,
+ new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
+ .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
+ content.getCode().getFilename())
+ .end()
+ .getRequestBody(),
+ requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentDetails.class));
+ }
+
+ /**
+ * Update an agent endpoint
+ *
+ * Applies a merge-patch update to the specified agent endpoint configuration.
+ *
+ * @param agentName The name of the agent to retrieve
+ *
+ * The name of the agent to retrieve.
+ * @param patchAgentObjectRequest The patchAgentObjectRequest parameter.
+ * @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 the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono updateAgentDetails(String agentName, UpdateAgentDetailsOptions patchAgentObjectRequest) {
+ // Generated convenience method for updateAgentDetailsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ JsonMergePatchHelper.getUpdateAgentDetailsOptionsAccessor()
+ .prepareModelForJsonMergePatch(patchAgentObjectRequest, true);
+ BinaryData patchAgentObjectRequestInBinaryData = BinaryData.fromObject(patchAgentObjectRequest);
+ // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
+ patchAgentObjectRequestInBinaryData.getLength();
+ JsonMergePatchHelper.getUpdateAgentDetailsOptionsAccessor()
+ .prepareModelForJsonMergePatch(patchAgentObjectRequest, false);
+ return updateAgentDetailsWithResponse(agentName, patchAgentObjectRequestInBinaryData, requestOptions)
+ .flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentDetails.class));
+ }
+
+ /**
+ * Create an agent version from code
+ *
+ * Creates a new agent version from code. Uploads the code zip and creates a new version
+ * for an existing agent. The SHA-256 hex digest of the zip is provided in the
+ * `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ *
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createAgentVersionFromCode(String agentName, String codeZipSha256,
+ CreateAgentVersionFromCodeContent content) {
+ // Generated convenience method for createAgentVersionFromCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createAgentVersionFromCodeWithResponse(agentName, codeZipSha256,
+ new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
+ .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
+ content.getCode().getFilename())
+ .end()
+ .getRequestBody(),
+ requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentVersionDetails.class));
+ }
+
+ /**
+ * Download agent code
+ *
+ * Downloads the code zip for a code-based hosted agent.
+ * Returns the previously-uploaded zip (`application/zip`).
+ *
+ * If `agent_version` is supplied, returns that version's code zip; otherwise
+ * returns the latest version's code zip.
+ *
+ * The SHA-256 digest of the returned bytes matches the `content_hash` on the
+ * resolved version's `code_configuration`.
+ *
+ * @param agentName The name of the agent.
+ * @param agentVersion The version of the agent whose code zip should be downloaded.
+ * If omitted, the latest version's code zip is returned.
+ * @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 the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono downloadAgentCode(String agentName, String agentVersion) {
+ // Generated convenience method for downloadAgentCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (agentVersion != null) {
+ requestOptions.addQueryParam("agent_version", agentVersion, false);
+ }
+ return downloadAgentCodeWithResponse(agentName, requestOptions).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Download agent code
+ *
+ * Downloads the code zip for a code-based hosted agent.
+ * Returns the previously-uploaded zip (`application/zip`).
+ *
+ * If `agent_version` is supplied, returns that version's code zip; otherwise
+ * returns the latest version's code zip.
+ *
+ * The SHA-256 digest of the returned bytes matches the `content_hash` on the
+ * resolved version's `code_configuration`.
+ *
+ * @param agentName The name of the agent.
+ * @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 the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono downloadAgentCode(String agentName) {
+ // Generated convenience method for downloadAgentCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return downloadAgentCodeWithResponse(agentName, requestOptions).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Create a session
+ *
+ * Creates a new session for an agent endpoint.
+ * The endpoint resolves the backing agent version from `version_indicator` and
+ * enforces session ownership using the provided isolation key for session-mutating operations.
+ *
+ * @param agentName The name of the agent to create a session for.
+ * @param versionIndicator Determines which agent version backs the session.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @param agentSessionId Optional caller-provided session ID. If specified, it must be unique within the agent
+ * endpoint. Auto-generated if omitted.
+ * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createSession(String agentName, VersionIndicator versionIndicator,
+ String userIsolationKey, String agentSessionId) {
+ // Generated convenience method for createSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ CreateSessionRequest createSessionRequestObj
+ = new CreateSessionRequest(versionIndicator).setAgentSessionId(agentSessionId);
+ BinaryData createSessionRequest = BinaryData.fromObject(createSessionRequestObj);
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return createSessionWithResponse(agentName, createSessionRequest, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class));
+ }
+
+ /**
+ * Create a session
+ *
+ * Creates a new session for an agent endpoint.
+ * The endpoint resolves the backing agent version from `version_indicator` and
+ * enforces session ownership using the provided isolation key for session-mutating operations.
+ *
+ * @param agentName The name of the agent to create a session for.
+ * @param versionIndicator Determines which agent version backs the session.
+ * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono createSession(String agentName, VersionIndicator versionIndicator) {
+ // Generated convenience method for createSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ CreateSessionRequest createSessionRequestObj = new CreateSessionRequest(versionIndicator);
+ BinaryData createSessionRequest = BinaryData.fromObject(createSessionRequestObj);
+ return createSessionWithResponse(agentName, createSessionRequest, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class));
+ }
+
+ /**
+ * Get a session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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 session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getSession(String agentName, String sessionId, String userIsolationKey) {
+ // Generated convenience method for getSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return getSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class));
+ }
+
+ /**
+ * Get a session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier on successful completion of
+ * {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getSession(String agentName, String sessionId) {
+ // Generated convenience method for getSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class));
+ }
+
+ /**
+ * Delete a session
+ *
+ * Deletes a session synchronously.
+ * Returns 204 No Content when the session is deleted or does not exist.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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 {@link Mono} that completes when a successful response is received.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteSession(String agentName, String sessionId, String userIsolationKey) {
+ // Generated convenience method for deleteSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return deleteSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Delete a session
+ *
+ * Deletes a session synchronously.
+ * Returns 204 No Content when the session is deleted or does not exist.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 {@link Mono} that completes when a successful response is received.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteSession(String agentName, String sessionId) {
+ // Generated convenience method for deleteSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Stop a session
+ *
+ * Terminates the specified hosted agent session and returns 204 No Content when the request succeeds.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 {@link Mono} that completes when a successful response is received.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono stopSession(String agentName, String sessionId) {
+ // Generated convenience method for stopSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return stopSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * List sessions for an agent
+ *
+ * Returns a paged collection of sessions associated with the specified agent endpoint.
+ *
+ * @param agentName The name of the agent.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
+ * default is 20.
+ * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
+ * for descending order.
+ * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listSessions(String agentName, String userIsolationKey, Integer limit,
+ PageOrder order, String after, String before) {
+ // Generated convenience method for listSessions
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ PagedFlux pagedFluxResponse = listSessions(agentName, requestOptions);
+ return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
+ Flux> flux = (continuationTokenParam == null)
+ ? pagedFluxResponse.byPage().take(1)
+ : pagedFluxResponse.byPage(continuationTokenParam).take(1);
+ return flux
+ .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
+ pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
+ pagedResponse.getValue()
+ .stream()
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List sessions for an agent
+ *
+ * Returns a paged collection of sessions associated with the specified agent endpoint.
+ *
+ * @param agentName The name of the agent.
+ * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listSessions(String agentName) {
+ // Generated convenience method for listSessions
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse = listSessions(agentName, requestOptions);
+ return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
+ Flux> flux = (continuationTokenParam == null)
+ ? pagedFluxResponse.byPage().take(1)
+ : pagedFluxResponse.byPage(continuationTokenParam).take(1);
+ return flux
+ .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
+ pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
+ pagedResponse.getValue()
+ .stream()
+ .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * Upload a session file
+ *
+ * Uploads binary file content to the specified path in the session sandbox.
+ * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The destination file path within the sandbox, relative to the session home directory.
+ * @param content The content parameter.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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 response from uploading a file to a session sandbox on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono uploadSessionFile(String agentName, String agentSessionId, String path,
+ BinaryData content, String userIsolationKey) {
+ // Generated convenience method for uploadSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return uploadSessionFileWithResponse(agentName, agentSessionId, path, content, requestOptions)
+ .flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(SessionFileWriteResult.class));
+ }
+
+ /**
+ * Upload a session file
+ *
+ * Uploads binary file content to the specified path in the session sandbox.
+ * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The destination file path within the sandbox, relative to the session home directory.
+ * @param content The content parameter.
+ * @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 response from uploading a file to a session sandbox on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono uploadSessionFile(String agentName, String agentSessionId, String path,
+ BinaryData content) {
+ // Generated convenience method for uploadSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return uploadSessionFileWithResponse(agentName, agentSessionId, path, content, requestOptions)
+ .flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(SessionFileWriteResult.class));
+ }
+
+ /**
+ * Download a session file
+ *
+ * Downloads the file at the specified sandbox path as a binary stream.
+ * The path is resolved relative to the session home directory.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file path to download from the sandbox, relative to the session home directory.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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 the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono downloadSessionFile(String agentName, String agentSessionId, String path,
+ String userIsolationKey) {
+ // Generated convenience method for downloadSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions)
+ .flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Download a session file
+ *
+ * Downloads the file at the specified sandbox path as a binary stream.
+ * The path is resolved relative to the session home directory.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file path to download from the sandbox, relative to the session home directory.
+ * @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 the response body on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono downloadSessionFile(String agentName, String agentSessionId, String path) {
+ // Generated convenience method for downloadSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions)
+ .flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * List session files
+ *
+ * Returns files and directories at the specified path in the session sandbox.
+ * The response includes only the immediate children of the target directory and defaults to the session home
+ * directory when no path is supplied.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The directory path to list, relative to the session home directory. Defaults to the home directory if
+ * not provided.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
+ * default is 20.
+ * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
+ * for descending order.
+ * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ * @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 the paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listSessionFiles(String agentName, String agentSessionId, String path,
+ String userIsolationKey, Integer limit, PageOrder order, String after, String before) {
+ // Generated convenience method for listSessionFiles
+ RequestOptions requestOptions = new RequestOptions();
+ if (path != null) {
+ requestOptions.addQueryParam("path", path, false);
+ }
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ PagedFlux pagedFluxResponse = listSessionFiles(agentName, agentSessionId, requestOptions);
+ return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
+ Flux> flux = (continuationTokenParam == null)
+ ? pagedFluxResponse.byPage().take(1)
+ : pagedFluxResponse.byPage(continuationTokenParam).take(1);
+ return flux
+ .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
+ pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
+ pagedResponse.getValue()
+ .stream()
+ .map(protocolMethodData -> protocolMethodData.toObject(SessionDirectoryEntry.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * List session files
+ *
+ * Returns files and directories at the specified path in the session sandbox.
+ * The response includes only the immediate children of the target directory and defaults to the session home
+ * directory when no path is supplied.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @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 the paginated response with {@link PagedFlux}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listSessionFiles(String agentName, String agentSessionId) {
+ // Generated convenience method for listSessionFiles
+ RequestOptions requestOptions = new RequestOptions();
+ PagedFlux pagedFluxResponse = listSessionFiles(agentName, agentSessionId, requestOptions);
+ return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
+ Flux> flux = (continuationTokenParam == null)
+ ? pagedFluxResponse.byPage().take(1)
+ : pagedFluxResponse.byPage(continuationTokenParam).take(1);
+ return flux
+ .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
+ pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
+ pagedResponse.getValue()
+ .stream()
+ .map(protocolMethodData -> protocolMethodData.toObject(SessionDirectoryEntry.class))
+ .collect(Collectors.toList()),
+ pagedResponse.getContinuationToken(), null));
+ });
+ }
+
+ /**
+ * Delete a session file
+ *
+ * Deletes the specified file or directory from the session sandbox.
+ * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file or directory path to delete, relative to the session home directory.
+ * @param recursive Whether to recursively delete directory contents. The service defaults to `false` if a value is
+ * not specified by the caller.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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 {@link Mono} that completes when a successful response is received.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteSessionFile(String agentName, String agentSessionId, String path, Boolean recursive,
+ String userIsolationKey) {
+ // Generated convenience method for deleteSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (recursive != null) {
+ requestOptions.addQueryParam("recursive", String.valueOf(recursive), false);
+ }
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Delete a session file
+ *
+ * Deletes the specified file or directory from the session sandbox.
+ * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file or directory path to delete, relative to the session home directory.
+ * @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 {@link Mono} that completes when a successful response is received.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono deleteSessionFile(String agentName, String agentSessionId, String path) {
+ // Generated convenience method for deleteSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Streams console logs (stdout / stderr) for a specific hosted agent session as typed
+ * {@link SessionLogEvent} values.
+ *
+ * @param agentName The name of the hosted agent.
+ * @param agentVersion The version of the agent.
+ * @param sessionId The session ID (maps to an ADC sandbox).
+ * @return A stream of {@link SessionLogEvent} values emitted by the hosted agent session log stream.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public Flux getSessionLogStream(String agentName, String agentVersion, String sessionId) {
+ RequestOptions requestOptions = new RequestOptions();
+ return getSessionLogStream(agentName, agentVersion, sessionId, requestOptions);
+ }
+
+ /**
+ * Streams console logs (stdout / stderr) for a specific hosted agent session as typed
+ * {@link SessionLogEvent} values.
+ *
+ * @param agentName The name of the hosted agent.
+ * @param agentVersion The version of the agent.
+ * @param sessionId The session ID (maps to an ADC sandbox).
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @return A stream of {@link SessionLogEvent} values emitted by the hosted agent session log stream.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public Flux getSessionLogStream(String agentName, String agentVersion, String sessionId,
+ RequestOptions requestOptions) {
+ return SessionLogStreamHelper
+ .parse(getSessionLogStreamWithResponse(agentName, agentVersion, sessionId, requestOptions)
+ .flatMapMany(response -> response.getValue().toFluxByteBuffer()));
+ }
+
+ /**
+ * Enable an agent
+ *
+ * Enables the specified agent, allowing it to accept new sessions and process requests.
+ * This operation is idempotent — enabling an already-enabled agent returns success with no side effects.
+ *
+ * @param agentName The name of the agent to enable.
+ * @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 the {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> enableAgentWithResponse(String agentName, RequestOptions requestOptions) {
+ return this.serviceClient.enableAgentWithResponseAsync(agentName, requestOptions);
+ }
+
+ /**
+ * Disable an agent
+ *
+ * Disables the specified agent, preventing it from accepting new sessions or processing requests.
+ * Existing active sessions are allowed to drain gracefully but no new sessions can be created.
+ * This operation is idempotent — disabling an already-disabled agent returns success with no side effects.
+ *
+ * @param agentName The name of the agent to disable.
+ * @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 the {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> disableAgentWithResponse(String agentName, RequestOptions requestOptions) {
+ return this.serviceClient.disableAgentWithResponseAsync(agentName, requestOptions);
+ }
+
+ /**
+ * Enable an agent
+ *
+ * Enables the specified agent, allowing it to accept new sessions and process requests.
+ * This operation is idempotent — enabling an already-enabled agent returns success with no side effects.
+ *
+ * @param agentName The name of the agent to enable.
+ * @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 {@link Mono} that completes when a successful response is received.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono enableAgent(String agentName) {
+ // Generated convenience method for enableAgentWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return enableAgentWithResponse(agentName, requestOptions).flatMap(FluxUtil::toMono);
+ }
+
+ /**
+ * Disable an agent
+ *
+ * Disables the specified agent, preventing it from accepting new sessions or processing requests.
+ * Existing active sessions are allowed to drain gracefully but no new sessions can be created.
+ * This operation is idempotent — disabling an already-disabled agent returns success with no side effects.
+ *
+ * @param agentName The name of the agent to disable.
+ * @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 {@link Mono} that completes when a successful response is received.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono disableAgent(String agentName) {
+ // Generated convenience method for disableAgentWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return disableAgentWithResponse(agentName, requestOptions).flatMap(FluxUtil::toMono);
+ }
}
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClient.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClient.java
index 825241bc2346..3861935fae9f 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClient.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClient.java
@@ -4,20 +4,32 @@
package com.azure.ai.agents;
import com.azure.ai.agents.implementation.AgentsImpl;
+import com.azure.ai.agents.implementation.JsonMergePatchHelper;
+import com.azure.ai.agents.implementation.MultipartFormDataHelper;
+import com.azure.ai.agents.implementation.SessionLogStreamHelper;
+import com.azure.ai.agents.implementation.models.CreateAgentFromCodeContent;
import com.azure.ai.agents.implementation.models.CreateAgentFromManifestRequest;
import com.azure.ai.agents.implementation.models.CreateAgentOptions;
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.CreateSessionRequest;
import com.azure.ai.agents.implementation.models.UpdateAgentFromManifestRequest;
import com.azure.ai.agents.implementation.models.UpdateAgentRequest;
import com.azure.ai.agents.models.AgentBlueprintReference;
import com.azure.ai.agents.models.AgentDefinition;
import com.azure.ai.agents.models.AgentDetails;
import com.azure.ai.agents.models.AgentKind;
+import com.azure.ai.agents.models.AgentSessionResource;
import com.azure.ai.agents.models.AgentVersionDetails;
+import com.azure.ai.agents.models.CreateAgentVersionFromCodeContent;
import com.azure.ai.agents.models.CreateAgentVersionInput;
import com.azure.ai.agents.models.PageOrder;
+import com.azure.ai.agents.models.SessionDirectoryEntry;
+import com.azure.ai.agents.models.SessionFileWriteResult;
+import com.azure.ai.agents.models.SessionLogEvent;
+import com.azure.ai.agents.models.UpdateAgentDetailsOptions;
+import com.azure.ai.agents.models.VersionIndicator;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
@@ -32,6 +44,7 @@
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.BinaryData;
+import com.azure.core.util.IterableStream;
import com.openai.models.conversations.Conversation;
import java.util.Map;
@@ -56,6 +69,7 @@ public final class AgentsClient {
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -449,6 +463,7 @@ public AgentVersionDetails createAgentVersion(String agentName, AgentDefinition
* {@code
* {
* name: String (Required)
+ * state: String(enabled/disabled) (Optional)
* metadata (Optional): {
* String: String (Required)
* }
@@ -509,6 +524,7 @@ public AgentVersionDetails createAgentVersion(String agentName, AgentDefinition
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -629,6 +645,7 @@ Response createAgentWithResponse(BinaryData createAgentRequest, Requ
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -783,6 +800,7 @@ AgentDetails updateAgent(String agentName, AgentDefinition definition) {
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -899,6 +917,7 @@ Response createAgentFromManifestWithResponse(BinaryData createAgentF
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1445,6 +1464,7 @@ public PagedIterable listAgentVersions(String agentName, In
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1804,7 +1824,8 @@ AgentDetails createAgent(CreateAgentOptions options) {
// Generated convenience method for createAgentWithResponse
RequestOptions requestOptions = new RequestOptions();
CreateAgentRequest createAgentRequestObj
- = new CreateAgentRequest(options.getAgentName(), options.getDefinition()).setMetadata(options.getMetadata())
+ = new CreateAgentRequest(options.getAgentName(), options.getDefinition()).setState(options.getState())
+ .setMetadata(options.getMetadata())
.setDescription(options.getDescription())
.setBlueprintReference(options.getBlueprintReference())
.setAgentEndpoint(options.getAgentEndpoint())
@@ -2022,4 +2043,1816 @@ AgentDetails updateAgent(String agentName, AgentDefinition definition, MapResponse Body Schema
+ *
+ *
+ * {@code
+ * {
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * state: String(enabled/disabled) (Required)
+ * versions (Required): {
+ * latest (Required): {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
+ * }
+ * }
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * instance_identity (Optional): (recursive schema, see instance_identity above)
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
+ * hyphens allowed in the middle.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response createAgentFromCodeWithResponse(String agentName, String codeZipSha256, BinaryData content,
+ RequestOptions requestOptions) {
+ // Operation 'createAgentFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable and
+ // hence not generated.
+ return this.serviceClient.createAgentFromCodeWithResponse(agentName, codeZipSha256, content, requestOptions);
+ }
+
+ /**
+ * Update a code-based agent
+ *
+ * Updates a code-based agent by uploading new code and creating a new version.
+ * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * state: String(enabled/disabled) (Required)
+ * versions (Required): {
+ * latest (Required): {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
+ * }
+ * }
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * instance_identity (Optional): (recursive schema, see instance_identity above)
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response updateAgentFromCodeWithResponse(String agentName, String codeZipSha256, BinaryData content,
+ RequestOptions requestOptions) {
+ // Operation 'updateAgentFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable and
+ // hence not generated.
+ return this.serviceClient.updateAgentFromCodeWithResponse(agentName, codeZipSha256, content, requestOptions);
+ }
+
+ /**
+ * Update an agent endpoint
+ *
+ * Applies a merge-patch update to the specified agent endpoint configuration.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * state: String(enabled/disabled) (Required)
+ * versions (Required): {
+ * latest (Required): {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
+ * }
+ * }
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * instance_identity (Optional): (recursive schema, see instance_identity above)
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent to retrieve
+ *
+ * The name of the agent to retrieve.
+ * @param patchAgentObjectRequest The patchAgentObjectRequest parameter.
+ * @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 the response body along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response updateAgentDetailsWithResponse(String agentName, BinaryData patchAgentObjectRequest,
+ RequestOptions requestOptions) {
+ return this.serviceClient.updateAgentDetailsWithResponse(agentName, patchAgentObjectRequest, requestOptions);
+ }
+
+ /**
+ * Create an agent version from code
+ *
+ * Creates a new agent version from code. Uploads the code zip and creates a new version
+ * for an existing agent. The SHA-256 hex digest of the zip is provided in the
+ * `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
+ * }
+ * }
+ *
+ *
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Response createAgentVersionFromCodeWithResponse(String agentName, String codeZipSha256,
+ BinaryData content, RequestOptions requestOptions) {
+ // Operation 'createAgentVersionFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable
+ // and hence not generated.
+ return this.serviceClient.createAgentVersionFromCodeWithResponse(agentName, codeZipSha256, content,
+ requestOptions);
+ }
+
+ /**
+ * Download agent code
+ *
+ * Downloads the code zip for a code-based hosted agent.
+ * Returns the previously-uploaded zip (`application/zip`).
+ *
+ * If `agent_version` is supplied, returns that version's code zip; otherwise
+ * returns the latest version's code zip.
+ *
+ * The SHA-256 digest of the returned bytes matches the `content_hash` on the
+ * resolved version's `code_configuration`.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | agent_version | String | No | The version of the agent whose code zip should be
+ * downloaded.
+ * If omitted, the latest version's code zip is returned. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * BinaryData
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @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 the response body along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response downloadAgentCodeWithResponse(String agentName, RequestOptions requestOptions) {
+ return this.serviceClient.downloadAgentCodeWithResponse(agentName, requestOptions);
+ }
+
+ /**
+ * Create a session
+ *
+ * Creates a new session for an agent endpoint.
+ * The endpoint resolves the backing agent version from `version_indicator` and
+ * enforces session ownership using the provided isolation key for session-mutating operations.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_session_id: String (Optional)
+ * version_indicator (Required): {
+ * type: String(version_ref) (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_session_id: String (Required)
+ * version_indicator (Required): {
+ * type: String(version_ref) (Required)
+ * }
+ * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
+ * created_at: long (Required)
+ * last_accessed_at: long (Required)
+ * expires_at: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent to create a session for.
+ * @param createSessionRequest The createSessionRequest parameter.
+ * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations along with
+ * {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response createSessionWithResponse(String agentName, BinaryData createSessionRequest,
+ RequestOptions requestOptions) {
+ return this.serviceClient.createSessionWithResponse(agentName, createSessionRequest, requestOptions);
+ }
+
+ /**
+ * Get a session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_session_id: String (Required)
+ * version_indicator (Required): {
+ * type: String(version_ref) (Required)
+ * }
+ * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
+ * created_at: long (Required)
+ * last_accessed_at: long (Required)
+ * expires_at: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getSessionWithResponse(String agentName, String sessionId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getSessionWithResponse(agentName, sessionId, requestOptions);
+ }
+
+ /**
+ * Delete a session
+ *
+ * Deletes a session synchronously.
+ * Returns 204 No Content when the session is deleted or does not exist.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 the {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteSessionWithResponse(String agentName, String sessionId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteSessionWithResponse(agentName, sessionId, requestOptions);
+ }
+
+ /**
+ * Stop a session
+ *
+ * Terminates the specified hosted agent session and returns 204 No Content when the request succeeds.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 the {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response stopSessionWithResponse(String agentName, String sessionId, RequestOptions requestOptions) {
+ return this.serviceClient.stopSessionWithResponse(agentName, sessionId, requestOptions);
+ }
+
+ /**
+ * List sessions for an agent
+ *
+ * Returns a paged collection of sessions associated with the specified agent endpoint.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
+ * between 1 and 100, and the
+ * default is 20. |
+ * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
+ * for ascending order and`desc`
+ * for descending order. Allowed values: "asc", "desc". |
+ * | after | String | No | A cursor for use in pagination. `after` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
+ * | before | String | No | A cursor for use in pagination. `before` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * agent_session_id: String (Required)
+ * version_indicator (Required): {
+ * type: String(version_ref) (Required)
+ * }
+ * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
+ * created_at: long (Required)
+ * last_accessed_at: long (Required)
+ * expires_at: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSessions(String agentName, RequestOptions requestOptions) {
+ return this.serviceClient.listSessions(agentName, requestOptions);
+ }
+
+ /**
+ * Stream console logs for a hosted agent session
+ *
+ * Streams console logs (stdout / stderr) for a specific hosted agent session
+ * as a Server-Sent Events (SSE) stream.
+ *
+ * Each SSE frame contains:
+ * - `event`: always `"log"`
+ * - `data`: a plain-text log line (currently JSON-formatted, but the schema
+ * is not contractual and may include additional keys or change format
+ * over time — clients should treat it as an opaque string)
+ *
+ * Example SSE frames:
+ * ```
+ * event: log
+ * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port
+ * 8088"}
+ *
+ * event: log
+ * data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."}
+ *
+ * event: log
+ * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"}
+ *
+ * event: log
+ * data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"}
+ * ```
+ *
+ * The stream remains open until the client disconnects or the server
+ * terminates the connection. Clients should handle reconnection as needed.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * event: String(log) (Required)
+ * data: String (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the hosted agent.
+ * @param agentVersion The version of the agent.
+ * @param sessionId The session ID (maps to an ADC sandbox).
+ * @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 single Server-Sent Event frame emitted by the hosted agent session log stream.
+ *
+ * Each frame contains an `event` field identifying the event type and a `data`
+ * field carrying the payload as plain text along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getSessionLogStreamWithResponse(String agentName, String agentVersion, String sessionId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getSessionLogStreamWithResponse(agentName, agentVersion, sessionId, requestOptions);
+ }
+
+ /**
+ * Upload a session file
+ *
+ * Uploads binary file content to the specified path in the session sandbox.
+ * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * BinaryData
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * path: String (Required)
+ * bytes_written: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The destination file path within the sandbox, relative to the session home directory.
+ * @param content The content parameter.
+ * @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 response from uploading a file to a session sandbox along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response uploadSessionFileWithResponse(String agentName, String agentSessionId, String path,
+ BinaryData content, RequestOptions requestOptions) {
+ return this.serviceClient.uploadSessionFileWithResponse(agentName, agentSessionId, path, content,
+ requestOptions);
+ }
+
+ /**
+ * Download a session file
+ *
+ * Downloads the file at the specified sandbox path as a binary stream.
+ * The path is resolved relative to the session home directory.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * BinaryData
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file path to download from the sandbox, relative to the session home directory.
+ * @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 the response body along with {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response downloadSessionFileWithResponse(String agentName, String agentSessionId, String path,
+ RequestOptions requestOptions) {
+ return this.serviceClient.downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions);
+ }
+
+ /**
+ * List session files
+ *
+ * Returns files and directories at the specified path in the session sandbox.
+ * The response includes only the immediate children of the target directory and defaults to the session home
+ * directory when no path is supplied.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | path | String | No | The directory path to list, relative to the session home
+ * directory. Defaults to the home directory if not provided. |
+ * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
+ * between 1 and 100, and the
+ * default is 20. |
+ * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
+ * for ascending order and`desc`
+ * for descending order. Allowed values: "asc", "desc". |
+ * | after | String | No | A cursor for use in pagination. `after` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
+ * | before | String | No | A cursor for use in pagination. `before` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * size: long (Required)
+ * is_directory: boolean (Required)
+ * modified_time: long (Required)
+ * }
+ * }
+ *
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @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 the paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSessionFiles(String agentName, String agentSessionId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.listSessionFiles(agentName, agentSessionId, requestOptions);
+ }
+
+ /**
+ * Delete a session file
+ *
+ * Deletes the specified file or directory from the session sandbox.
+ * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | recursive | Boolean | No | Whether to recursively delete directory contents. The
+ * service defaults to `false` if a value is not specified by the caller. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
+ * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file or directory path to delete, relative to the session home directory.
+ * @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 the {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response deleteSessionFileWithResponse(String agentName, String agentSessionId, String path,
+ RequestOptions requestOptions) {
+ return this.serviceClient.deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions);
+ }
+
+ /**
+ * Create a new code-based agent
+ *
+ * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
+ * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
+ * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ *
+ * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
+ * hyphens allowed in the middle.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ AgentDetails createAgentFromCode(String agentName, String codeZipSha256, CreateAgentFromCodeContent content) {
+ // Generated convenience method for createAgentFromCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createAgentFromCodeWithResponse(agentName, codeZipSha256,
+ new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
+ .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
+ content.getCode().getFilename())
+ .end()
+ .getRequestBody(),
+ requestOptions).getValue().toObject(AgentDetails.class);
+ }
+
+ /**
+ * Update a code-based agent
+ *
+ * Updates a code-based agent by uploading new code and creating a new version.
+ * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ *
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AgentDetails updateAgentFromCode(String agentName, String codeZipSha256,
+ CreateAgentVersionFromCodeContent content) {
+ // Generated convenience method for updateAgentFromCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return updateAgentFromCodeWithResponse(agentName, codeZipSha256,
+ new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
+ .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
+ content.getCode().getFilename())
+ .end()
+ .getRequestBody(),
+ requestOptions).getValue().toObject(AgentDetails.class);
+ }
+
+ /**
+ * Update an agent endpoint
+ *
+ * Applies a merge-patch update to the specified agent endpoint configuration.
+ *
+ * @param agentName The name of the agent to retrieve
+ *
+ * The name of the agent to retrieve.
+ * @param patchAgentObjectRequest The patchAgentObjectRequest parameter.
+ * @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 the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AgentDetails updateAgentDetails(String agentName, UpdateAgentDetailsOptions patchAgentObjectRequest) {
+ // Generated convenience method for updateAgentDetailsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ JsonMergePatchHelper.getUpdateAgentDetailsOptionsAccessor()
+ .prepareModelForJsonMergePatch(patchAgentObjectRequest, true);
+ BinaryData patchAgentObjectRequestInBinaryData = BinaryData.fromObject(patchAgentObjectRequest);
+ // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
+ patchAgentObjectRequestInBinaryData.getLength();
+ JsonMergePatchHelper.getUpdateAgentDetailsOptionsAccessor()
+ .prepareModelForJsonMergePatch(patchAgentObjectRequest, false);
+ return updateAgentDetailsWithResponse(agentName, patchAgentObjectRequestInBinaryData, requestOptions).getValue()
+ .toObject(AgentDetails.class);
+ }
+
+ /**
+ * Create an agent version from code
+ *
+ * Creates a new agent version from code. Uploads the code zip and creates a new version
+ * for an existing agent. The SHA-256 hex digest of the zip is provided in the
+ * `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ *
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AgentVersionDetails createAgentVersionFromCode(String agentName, String codeZipSha256,
+ CreateAgentVersionFromCodeContent content) {
+ // Generated convenience method for createAgentVersionFromCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createAgentVersionFromCodeWithResponse(agentName, codeZipSha256,
+ new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
+ .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
+ content.getCode().getFilename())
+ .end()
+ .getRequestBody(),
+ requestOptions).getValue().toObject(AgentVersionDetails.class);
+ }
+
+ /**
+ * Download agent code
+ *
+ * Downloads the code zip for a code-based hosted agent.
+ * Returns the previously-uploaded zip (`application/zip`).
+ *
+ * If `agent_version` is supplied, returns that version's code zip; otherwise
+ * returns the latest version's code zip.
+ *
+ * The SHA-256 digest of the returned bytes matches the `content_hash` on the
+ * resolved version's `code_configuration`.
+ *
+ * @param agentName The name of the agent.
+ * @param agentVersion The version of the agent whose code zip should be downloaded.
+ * If omitted, the latest version's code zip is returned.
+ * @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 the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public BinaryData downloadAgentCode(String agentName, String agentVersion) {
+ // Generated convenience method for downloadAgentCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (agentVersion != null) {
+ requestOptions.addQueryParam("agent_version", agentVersion, false);
+ }
+ return downloadAgentCodeWithResponse(agentName, requestOptions).getValue();
+ }
+
+ /**
+ * Download agent code
+ *
+ * Downloads the code zip for a code-based hosted agent.
+ * Returns the previously-uploaded zip (`application/zip`).
+ *
+ * If `agent_version` is supplied, returns that version's code zip; otherwise
+ * returns the latest version's code zip.
+ *
+ * The SHA-256 digest of the returned bytes matches the `content_hash` on the
+ * resolved version's `code_configuration`.
+ *
+ * @param agentName The name of the agent.
+ * @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 the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public BinaryData downloadAgentCode(String agentName) {
+ // Generated convenience method for downloadAgentCodeWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return downloadAgentCodeWithResponse(agentName, requestOptions).getValue();
+ }
+
+ /**
+ * Create a session
+ *
+ * Creates a new session for an agent endpoint.
+ * The endpoint resolves the backing agent version from `version_indicator` and
+ * enforces session ownership using the provided isolation key for session-mutating operations.
+ *
+ * @param agentName The name of the agent to create a session for.
+ * @param versionIndicator Determines which agent version backs the session.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @param agentSessionId Optional caller-provided session ID. If specified, it must be unique within the agent
+ * endpoint. Auto-generated if omitted.
+ * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AgentSessionResource createSession(String agentName, VersionIndicator versionIndicator,
+ String userIsolationKey, String agentSessionId) {
+ // Generated convenience method for createSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ CreateSessionRequest createSessionRequestObj
+ = new CreateSessionRequest(versionIndicator).setAgentSessionId(agentSessionId);
+ BinaryData createSessionRequest = BinaryData.fromObject(createSessionRequestObj);
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return createSessionWithResponse(agentName, createSessionRequest, requestOptions).getValue()
+ .toObject(AgentSessionResource.class);
+ }
+
+ /**
+ * Create a session
+ *
+ * Creates a new session for an agent endpoint.
+ * The endpoint resolves the backing agent version from `version_indicator` and
+ * enforces session ownership using the provided isolation key for session-mutating operations.
+ *
+ * @param agentName The name of the agent to create a session for.
+ * @param versionIndicator Determines which agent version backs the session.
+ * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AgentSessionResource createSession(String agentName, VersionIndicator versionIndicator) {
+ // Generated convenience method for createSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ CreateSessionRequest createSessionRequestObj = new CreateSessionRequest(versionIndicator);
+ BinaryData createSessionRequest = BinaryData.fromObject(createSessionRequestObj);
+ return createSessionWithResponse(agentName, createSessionRequest, requestOptions).getValue()
+ .toObject(AgentSessionResource.class);
+ }
+
+ /**
+ * Get a session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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 session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AgentSessionResource getSession(String agentName, String sessionId, String userIsolationKey) {
+ // Generated convenience method for getSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return getSessionWithResponse(agentName, sessionId, requestOptions).getValue()
+ .toObject(AgentSessionResource.class);
+ }
+
+ /**
+ * Get a session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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 session
+ *
+ * Retrieves the details of a hosted agent session by agent name and session identifier.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AgentSessionResource getSession(String agentName, String sessionId) {
+ // Generated convenience method for getSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getSessionWithResponse(agentName, sessionId, requestOptions).getValue()
+ .toObject(AgentSessionResource.class);
+ }
+
+ /**
+ * Delete a session
+ *
+ * Deletes a session synchronously.
+ * Returns 204 No Content when the session is deleted or does not exist.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void deleteSession(String agentName, String sessionId, String userIsolationKey) {
+ // Generated convenience method for deleteSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ deleteSessionWithResponse(agentName, sessionId, requestOptions).getValue();
+ }
+
+ /**
+ * Delete a session
+ *
+ * Deletes a session synchronously.
+ * Returns 204 No Content when the session is deleted or does not exist.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void deleteSession(String agentName, String sessionId) {
+ // Generated convenience method for deleteSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ deleteSessionWithResponse(agentName, sessionId, requestOptions).getValue();
+ }
+
+ /**
+ * Stop a session
+ *
+ * Terminates the specified hosted agent session and returns 204 No Content when the request succeeds.
+ *
+ * @param agentName The name of the agent.
+ * @param sessionId The session identifier.
+ * @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.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void stopSession(String agentName, String sessionId) {
+ // Generated convenience method for stopSessionWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ stopSessionWithResponse(agentName, sessionId, requestOptions).getValue();
+ }
+
+ /**
+ * List sessions for an agent
+ *
+ * Returns a paged collection of sessions associated with the specified agent endpoint.
+ *
+ * @param agentName The name of the agent.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
+ * default is 20.
+ * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
+ * for descending order.
+ * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSessions(String agentName, String userIsolationKey, Integer limit,
+ PageOrder order, String after, String before) {
+ // Generated convenience method for listSessions
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return serviceClient.listSessions(agentName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(AgentSessionResource.class));
+ }
+
+ /**
+ * List sessions for an agent
+ *
+ * Returns a paged collection of sessions associated with the specified agent endpoint.
+ *
+ * @param agentName The name of the agent.
+ * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSessions(String agentName) {
+ // Generated convenience method for listSessions
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.listSessions(agentName, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(AgentSessionResource.class));
+ }
+
+ /**
+ * Upload a session file
+ *
+ * Uploads binary file content to the specified path in the session sandbox.
+ * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The destination file path within the sandbox, relative to the session home directory.
+ * @param content The content parameter.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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 response from uploading a file to a session sandbox.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public SessionFileWriteResult uploadSessionFile(String agentName, String agentSessionId, String path,
+ BinaryData content, String userIsolationKey) {
+ // Generated convenience method for uploadSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return uploadSessionFileWithResponse(agentName, agentSessionId, path, content, requestOptions).getValue()
+ .toObject(SessionFileWriteResult.class);
+ }
+
+ /**
+ * Upload a session file
+ *
+ * Uploads binary file content to the specified path in the session sandbox.
+ * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The destination file path within the sandbox, relative to the session home directory.
+ * @param content The content parameter.
+ * @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 response from uploading a file to a session sandbox.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public SessionFileWriteResult uploadSessionFile(String agentName, String agentSessionId, String path,
+ BinaryData content) {
+ // Generated convenience method for uploadSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return uploadSessionFileWithResponse(agentName, agentSessionId, path, content, requestOptions).getValue()
+ .toObject(SessionFileWriteResult.class);
+ }
+
+ /**
+ * Download a session file
+ *
+ * Downloads the file at the specified sandbox path as a binary stream.
+ * The path is resolved relative to the session home directory.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file path to download from the sandbox, relative to the session home directory.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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 the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public BinaryData downloadSessionFile(String agentName, String agentSessionId, String path,
+ String userIsolationKey) {
+ // Generated convenience method for downloadSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ return downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).getValue();
+ }
+
+ /**
+ * Download a session file
+ *
+ * Downloads the file at the specified sandbox path as a binary stream.
+ * The path is resolved relative to the session home directory.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file path to download from the sandbox, relative to the session home directory.
+ * @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 the response.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public BinaryData downloadSessionFile(String agentName, String agentSessionId, String path) {
+ // Generated convenience method for downloadSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).getValue();
+ }
+
+ /**
+ * List session files
+ *
+ * Returns files and directories at the specified path in the session sandbox.
+ * The response includes only the immediate children of the target directory and defaults to the session home
+ * directory when no path is supplied.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The directory path to list, relative to the session home directory. Defaults to the home directory if
+ * not provided.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
+ * default is 20.
+ * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
+ * for descending order.
+ * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list.
+ * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ * @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 the paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSessionFiles(String agentName, String agentSessionId, String path,
+ String userIsolationKey, Integer limit, PageOrder order, String after, String before) {
+ // Generated convenience method for listSessionFiles
+ RequestOptions requestOptions = new RequestOptions();
+ if (path != null) {
+ requestOptions.addQueryParam("path", path, false);
+ }
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ if (limit != null) {
+ requestOptions.addQueryParam("limit", String.valueOf(limit), false);
+ }
+ if (order != null) {
+ requestOptions.addQueryParam("order", order.toString(), false);
+ }
+ if (after != null) {
+ requestOptions.addQueryParam("after", after, false);
+ }
+ if (before != null) {
+ requestOptions.addQueryParam("before", before, false);
+ }
+ return serviceClient.listSessionFiles(agentName, agentSessionId, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(SessionDirectoryEntry.class));
+ }
+
+ /**
+ * List session files
+ *
+ * Returns files and directories at the specified path in the session sandbox.
+ * The response includes only the immediate children of the target directory and defaults to the session home
+ * directory when no path is supplied.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @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 the paginated response with {@link PagedIterable}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listSessionFiles(String agentName, String agentSessionId) {
+ // Generated convenience method for listSessionFiles
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.listSessionFiles(agentName, agentSessionId, requestOptions)
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(SessionDirectoryEntry.class));
+ }
+
+ /**
+ * Delete a session file
+ *
+ * Deletes the specified file or directory from the session sandbox.
+ * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file or directory path to delete, relative to the session home directory.
+ * @param recursive Whether to recursively delete directory contents. The service defaults to `false` if a value is
+ * not specified by the caller.
+ * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
+ * conversations, sessions) to a specific end user.
+ * @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.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void deleteSessionFile(String agentName, String agentSessionId, String path, Boolean recursive,
+ String userIsolationKey) {
+ // Generated convenience method for deleteSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (recursive != null) {
+ requestOptions.addQueryParam("recursive", String.valueOf(recursive), false);
+ }
+ if (userIsolationKey != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
+ }
+ deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).getValue();
+ }
+
+ /**
+ * Delete a session file
+ *
+ * Deletes the specified file or directory from the session sandbox.
+ * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
+ *
+ * @param agentName The name of the agent.
+ * @param agentSessionId The session ID.
+ * @param path The file or directory path to delete, relative to the session home directory.
+ * @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.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void deleteSessionFile(String agentName, String agentSessionId, String path) {
+ // Generated convenience method for deleteSessionFileWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).getValue();
+ }
+
+ /**
+ * Streams console logs (stdout / stderr) for a specific hosted agent session as typed
+ * {@link SessionLogEvent} values.
+ *
+ * @param agentName The name of the hosted agent.
+ * @param agentVersion The version of the agent.
+ * @param sessionId The session ID (maps to an ADC sandbox).
+ * @return A stream of {@link SessionLogEvent} values emitted by the hosted agent session log stream.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public IterableStream getSessionLogStream(String agentName, String agentVersion,
+ String sessionId) {
+ RequestOptions requestOptions = new RequestOptions();
+ return getSessionLogStream(agentName, agentVersion, sessionId, requestOptions);
+ }
+
+ /**
+ * Streams console logs (stdout / stderr) for a specific hosted agent session as typed
+ * {@link SessionLogEvent} values.
+ *
+ * @param agentName The name of the hosted agent.
+ * @param agentVersion The version of the agent.
+ * @param sessionId The session ID (maps to an ADC sandbox).
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @return A stream of {@link SessionLogEvent} values emitted by the hosted agent session log stream.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public IterableStream getSessionLogStream(String agentName, String agentVersion, String sessionId,
+ RequestOptions requestOptions) {
+ return new IterableStream<>(SessionLogStreamHelper
+ .parse(getSessionLogStreamWithResponse(agentName, agentVersion, sessionId, requestOptions).getValue()
+ .toFluxByteBuffer()));
+ }
+
+ /**
+ * Enable an agent
+ *
+ * Enables the specified agent, allowing it to accept new sessions and process requests.
+ * This operation is idempotent — enabling an already-enabled agent returns success with no side effects.
+ *
+ * @param agentName The name of the agent to enable.
+ * @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 the {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response enableAgentWithResponse(String agentName, RequestOptions requestOptions) {
+ return this.serviceClient.enableAgentWithResponse(agentName, requestOptions);
+ }
+
+ /**
+ * Disable an agent
+ *
+ * Disables the specified agent, preventing it from accepting new sessions or processing requests.
+ * Existing active sessions are allowed to drain gracefully but no new sessions can be created.
+ * This operation is idempotent — disabling an already-disabled agent returns success with no side effects.
+ *
+ * @param agentName The name of the agent to disable.
+ * @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 the {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response disableAgentWithResponse(String agentName, RequestOptions requestOptions) {
+ return this.serviceClient.disableAgentWithResponse(agentName, requestOptions);
+ }
+
+ /**
+ * Enable an agent
+ *
+ * Enables the specified agent, allowing it to accept new sessions and process requests.
+ * This operation is idempotent — enabling an already-enabled agent returns success with no side effects.
+ *
+ * @param agentName The name of the agent to enable.
+ * @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.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void enableAgent(String agentName) {
+ // Generated convenience method for enableAgentWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ enableAgentWithResponse(agentName, requestOptions).getValue();
+ }
+
+ /**
+ * Disable an agent
+ *
+ * Disables the specified agent, preventing it from accepting new sessions or processing requests.
+ * Existing active sessions are allowed to drain gracefully but no new sessions can be created.
+ * This operation is idempotent — disabling an already-disabled agent returns success with no side effects.
+ *
+ * @param agentName The name of the agent to disable.
+ * @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.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public void disableAgent(String agentName) {
+ // Generated convenience method for disableAgentWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ disableAgentWithResponse(agentName, requestOptions).getValue();
+ }
}
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClientBuilder.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClientBuilder.java
index f90649a6003c..f09fceaa6d0e 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClientBuilder.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/AgentsClientBuilder.java
@@ -61,13 +61,13 @@
@ServiceClientBuilder(
serviceClients = {
BetaMemoryStoresClient.class,
- BetaToolboxesClient.class,
BetaAgentsClient.class,
AgentsClient.class,
+ ToolboxesClient.class,
BetaMemoryStoresAsyncClient.class,
- BetaToolboxesAsyncClient.class,
BetaAgentsAsyncClient.class,
- AgentsAsyncClient.class })
+ AgentsAsyncClient.class,
+ ToolboxesAsyncClient.class })
public final class AgentsClientBuilder
implements HttpTrait, ConfigurationTrait,
TokenCredentialTrait, EndpointTrait {
@@ -86,14 +86,12 @@ public final class AgentsClientBuilder
private static final String AGENT_PREVIEW_FEATURES = Stream
.concat(Arrays.stream(AgentDefinitionOptInKeys.values()).map(AgentDefinitionOptInKeys::toString),
- Stream.of(FoundryFeaturesOptInKeys.AGENTS_OPTIMIZATION_V1_PREVIEW.toString()))
+ Stream.of(FoundryFeaturesOptInKeys.AGENTS_OPTIMIZATION_V2_PREVIEW.toString()))
.collect(Collectors.joining(","));
private static final String MEMORY_STORES_PREVIEW_FEATURES
= FoundryFeaturesOptInKeys.MEMORY_STORES_V1_PREVIEW.toString();
- private static final String TOOLBOXES_PREVIEW_FEATURES = FoundryFeaturesOptInKeys.TOOLBOXES_V1_PREVIEW.toString();
-
private boolean allowPreview;
@Generated
@@ -543,10 +541,8 @@ public BetaAgentsClientBuilder beta() {
serviceClients = {
BetaAgentsClient.class,
BetaMemoryStoresClient.class,
- BetaToolboxesClient.class,
BetaAgentsAsyncClient.class,
- BetaMemoryStoresAsyncClient.class,
- BetaToolboxesAsyncClient.class })
+ BetaMemoryStoresAsyncClient.class })
public final class BetaAgentsClientBuilder {
/**
@@ -576,16 +572,6 @@ public BetaMemoryStoresAsyncClient buildBetaMemoryStoresAsyncClient() {
buildInnerClient(MEMORY_STORES_PREVIEW_FEATURES).getBetaMemoryStores());
}
- /**
- * Builds an instance of BetaToolboxesAsyncClient class.
- *
- * @return an instance of BetaToolboxesAsyncClient.
- */
- @Beta
- public BetaToolboxesAsyncClient buildBetaToolboxesAsyncClient() {
- return new BetaToolboxesAsyncClient(buildInnerClient(TOOLBOXES_PREVIEW_FEATURES).getBetaToolboxes());
- }
-
/**
* Builds an instance of BetaAgentsClient class.
*
@@ -605,16 +591,6 @@ public BetaAgentsClient buildBetaAgentsClient() {
public BetaMemoryStoresClient buildBetaMemoryStoresClient() {
return new BetaMemoryStoresClient(buildInnerClient(MEMORY_STORES_PREVIEW_FEATURES).getBetaMemoryStores());
}
-
- /**
- * Builds an instance of BetaToolboxesClient class.
- *
- * @return an instance of BetaToolboxesClient.
- */
- @Beta
- public BetaToolboxesClient buildBetaToolboxesClient() {
- return new BetaToolboxesClient(buildInnerClient(TOOLBOXES_PREVIEW_FEATURES).getBetaToolboxes());
- }
}
/**
@@ -635,15 +611,6 @@ private BetaMemoryStoresAsyncClient buildBetaMemoryStoresAsyncClient() {
return new BetaMemoryStoresAsyncClient(buildInnerClient(MEMORY_STORES_PREVIEW_FEATURES).getBetaMemoryStores());
}
- /**
- * Builds an instance of BetaToolboxesAsyncClient class.
- *
- * @return an instance of BetaToolboxesAsyncClient.
- */
- private BetaToolboxesAsyncClient buildBetaToolboxesAsyncClient() {
- return new BetaToolboxesAsyncClient(buildInnerClient(TOOLBOXES_PREVIEW_FEATURES).getBetaToolboxes());
- }
-
/**
* Builds an instance of BetaAgentsClient class.
*
@@ -663,11 +630,22 @@ private BetaMemoryStoresClient buildBetaMemoryStoresClient() {
}
/**
- * Builds an instance of BetaToolboxesClient class.
+ * Builds an instance of ToolboxesAsyncClient class.
+ *
+ * @return an instance of ToolboxesAsyncClient.
+ */
+ @Generated
+ public ToolboxesAsyncClient buildToolboxesAsyncClient() {
+ return new ToolboxesAsyncClient(buildInnerClient().getToolboxes());
+ }
+
+ /**
+ * Builds an instance of ToolboxesClient class.
*
- * @return an instance of BetaToolboxesClient.
+ * @return an instance of ToolboxesClient.
*/
- private BetaToolboxesClient buildBetaToolboxesClient() {
- return new BetaToolboxesClient(buildInnerClient(TOOLBOXES_PREVIEW_FEATURES).getBetaToolboxes());
+ @Generated
+ public ToolboxesClient buildToolboxesClient() {
+ return new ToolboxesClient(buildInnerClient().getToolboxes());
}
}
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaAgentsAsyncClient.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaAgentsAsyncClient.java
index 951f0afbe8bf..9d45e16255b7 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaAgentsAsyncClient.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaAgentsAsyncClient.java
@@ -4,31 +4,11 @@
package com.azure.ai.agents;
import com.azure.ai.agents.implementation.BetaAgentsImpl;
-import com.azure.ai.agents.implementation.JsonMergePatchHelper;
-import com.azure.ai.agents.implementation.MultipartFormDataHelper;
-import com.azure.ai.agents.implementation.SessionLogStreamHelper;
-import com.azure.ai.agents.implementation.models.CreateAgentFromCodeContent;
-import com.azure.ai.agents.implementation.models.CreateSessionRequest;
import com.azure.ai.agents.implementation.utils.Beta;
-import com.azure.ai.agents.models.AgentDetails;
-import com.azure.ai.agents.models.AgentSessionResource;
-import com.azure.ai.agents.models.AgentVersionDetails;
-import com.azure.ai.agents.models.CandidateDeployConfig;
-import com.azure.ai.agents.models.CandidateMetadata;
-import com.azure.ai.agents.models.CandidateResults;
-import com.azure.ai.agents.models.CreateAgentVersionFromCodeContent;
import com.azure.ai.agents.models.JobStatus;
-import com.azure.ai.agents.models.OptimizationCandidate;
import com.azure.ai.agents.models.OptimizationJob;
-import com.azure.ai.agents.models.OptimizationJobInputs;
+import com.azure.ai.agents.models.OptimizationJobListItem;
import com.azure.ai.agents.models.PageOrder;
-import com.azure.ai.agents.models.PromoteCandidateInput;
-import com.azure.ai.agents.models.PromoteCandidateResult;
-import com.azure.ai.agents.models.SessionDirectoryEntry;
-import com.azure.ai.agents.models.SessionFileWriteResult;
-import com.azure.ai.agents.models.SessionLogEvent;
-import com.azure.ai.agents.models.UpdateAgentDetailsOptions;
-import com.azure.ai.agents.models.VersionIndicator;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
@@ -70,3035 +50,531 @@ public final class BetaAgentsAsyncClient {
}
/**
- * Create a new code-based agent
+ * Creates an agent optimization job.
*
- * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
- * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
- * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- * Response Body Schema
+ * Create an optimization job. Returns 201 with the queued job. Honours `Operation-Id` for idempotent retry.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | Operation-Id | String | No | Client-generated unique ID for idempotent retries. When
+ * absent, the server creates the job unconditionally. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Request Body Schema
*
*
* {@code
* {
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
- * name: String (Required)
- * versions (Required): {
- * latest (Required): {
- * metadata (Required): {
- * String: String (Required)
- * }
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * id: String (Required)
- * name: String (Required)
- * version: String (Required)
- * description: String (Optional)
- * created_at: long (Required)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
- * }
- * }
- * status: String(creating/active/failed/deleting/deleted) (Optional)
- * instance_identity (Optional): {
- * principal_id: String (Required)
- * client_id: String (Required)
+ * inputs (Optional): {
+ * agent (Required): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * train_dataset (Required): {
+ * type: String(inline/reference) (Required)
+ * }
+ * validation_dataset (Optional): (recursive schema, see validation_dataset above)
+ * evaluators (Required): [
+ * (Required){
+ * name: String (Required)
+ * version: String (Optional)
* }
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * ]
+ * options (Optional): {
+ * max_candidates: Integer (Optional)
+ * optimization_config (Optional): {
+ * String: BinaryData (Required)
* }
- * agent_guid: String (Optional)
+ * eval_model: String (Optional)
+ * optimization_model: String (Optional)
+ * evaluation_level: String(turn/conversation) (Optional)
* }
* }
- * agent_endpoint (Optional): {
- * version_selector (Optional): {
- * version_selection_rules (Optional, Required on create): [
- * (Optional, Required on create){
- * type: String(FixedRatio) (Required)
- * agent_version: String (Optional, Required on create)
- * }
- * ]
- * }
- * protocols (Optional): [
- * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
- * ]
- * authorization_schemes (Optional): [
+ * result (Optional): {
+ * baseline: String (Optional)
+ * best: String (Optional)
+ * candidates (Optional): [
* (Optional){
- * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * candidate_id: String (Optional)
+ * name: String (Required)
+ * mutations (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * avg_score: double (Required)
+ * avg_tokens: double (Required)
+ * eval_id: String (Optional)
+ * eval_run_id: String (Optional)
+ * promotion (Optional): {
+ * promoted_at: long (Required)
+ * agent_name: String (Required)
+ * agent_version: String (Required)
+ * }
* }
* ]
* }
- * instance_identity (Optional): (recursive schema, see instance_identity above)
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
- * agent_card (Optional): {
- * version: String (Optional, Required on create)
- * description: String (Optional)
- * skills (Optional, Required on create): [
- * (Optional, Required on create){
- * id: String (Optional, Required on create)
- * name: String (Optional, Required on create)
- * description: String (Optional)
- * tags (Optional): [
- * String (Optional)
- * ]
- * examples (Optional): [
- * String (Optional)
- * ]
- * }
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
* ]
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
* }
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
+ * }
+ * warnings (Optional): [
+ * String (Optional)
+ * ]
* }
* }
*
- *
- * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
- * hyphens allowed in the middle.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- Mono> createAgentFromCodeWithResponse(String agentName, String codeZipSha256,
- BinaryData content, RequestOptions requestOptions) {
- // Operation 'createAgentFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable and
- // hence not generated.
- return this.serviceClient.createAgentFromCodeWithResponseAsync(agentName, codeZipSha256, content,
- requestOptions);
- }
-
- /**
- * Update a code-based agent
- *
- * Updates a code-based agent by uploading new code and creating a new version.
- * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
+ *
* Response Body Schema
*
*
* {@code
* {
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
- * name: String (Required)
- * versions (Required): {
- * latest (Required): {
- * metadata (Required): {
- * String: String (Required)
- * }
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * id: String (Required)
- * name: String (Required)
- * version: String (Required)
- * description: String (Optional)
- * created_at: long (Required)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
- * }
- * }
- * status: String(creating/active/failed/deleting/deleted) (Optional)
- * instance_identity (Optional): {
- * principal_id: String (Required)
- * client_id: String (Required)
+ * inputs (Optional): {
+ * agent (Required): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * train_dataset (Required): {
+ * type: String(inline/reference) (Required)
+ * }
+ * validation_dataset (Optional): (recursive schema, see validation_dataset above)
+ * evaluators (Required): [
+ * (Required){
+ * name: String (Required)
+ * version: String (Optional)
* }
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * ]
+ * options (Optional): {
+ * max_candidates: Integer (Optional)
+ * optimization_config (Optional): {
+ * String: BinaryData (Required)
* }
- * agent_guid: String (Optional)
+ * eval_model: String (Optional)
+ * optimization_model: String (Optional)
+ * evaluation_level: String(turn/conversation) (Optional)
* }
* }
- * agent_endpoint (Optional): {
- * version_selector (Optional): {
- * version_selection_rules (Optional, Required on create): [
- * (Optional, Required on create){
- * type: String(FixedRatio) (Required)
- * agent_version: String (Optional, Required on create)
- * }
- * ]
- * }
- * protocols (Optional): [
- * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
- * ]
- * authorization_schemes (Optional): [
+ * result (Optional): {
+ * baseline: String (Optional)
+ * best: String (Optional)
+ * candidates (Optional): [
* (Optional){
- * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * candidate_id: String (Optional)
+ * name: String (Required)
+ * mutations (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * avg_score: double (Required)
+ * avg_tokens: double (Required)
+ * eval_id: String (Optional)
+ * eval_run_id: String (Optional)
+ * promotion (Optional): {
+ * promoted_at: long (Required)
+ * agent_name: String (Required)
+ * agent_version: String (Required)
+ * }
* }
* ]
* }
- * instance_identity (Optional): (recursive schema, see instance_identity above)
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
- * agent_card (Optional): {
- * version: String (Optional, Required on create)
- * description: String (Optional)
- * skills (Optional, Required on create): [
- * (Optional, Required on create){
- * id: String (Optional, Required on create)
- * name: String (Optional, Required on create)
- * description: String (Optional)
- * tags (Optional): [
- * String (Optional)
- * ]
- * examples (Optional): [
- * String (Optional)
- * ]
- * }
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
* ]
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * }
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
* }
+ * warnings (Optional): [
+ * String (Optional)
+ * ]
* }
* }
*
*
- * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
- * - Must start and end with alphanumeric characters,
- * - Can contain hyphens in the middle
- * - Must not exceed 63 characters.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
+ * @param job The job to create.
* @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ * @return agent optimization job resource — a long-running job that optimizes an agent's configuration
+ * (instructions, model, skills, tools) to maximize evaluation scores along with {@link Response} on successful
+ * completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Mono> updateAgentFromCodeWithResponse(String agentName, String codeZipSha256,
- BinaryData content, RequestOptions requestOptions) {
- // Operation 'updateAgentFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable and
- // hence not generated.
- return this.serviceClient.updateAgentFromCodeWithResponseAsync(agentName, codeZipSha256, content,
- requestOptions);
+ public Mono> createOptimizationJobWithResponse(BinaryData job, RequestOptions requestOptions) {
+ return this.serviceClient.createOptimizationJobWithResponseAsync(job, requestOptions);
}
/**
- * Update an agent endpoint
+ * Get info about an agent optimization job.
*
- * Applies a merge-patch update to the specified agent endpoint configuration.
- * Request Body Schema
- *
- *
- * {@code
- * {
- * agent_endpoint (Optional): {
- * version_selector (Optional): {
- * version_selection_rules (Optional, Required on create): [
- * (Optional, Required on create){
- * type: String(FixedRatio) (Required)
- * agent_version: String (Optional, Required on create)
- * }
- * ]
- * }
- * protocols (Optional): [
- * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
- * ]
- * authorization_schemes (Optional): [
- * (Optional){
- * type: String(Entra/BotService/BotServiceRbac) (Required)
- * }
- * ]
- * }
- * agent_card (Optional): {
- * version: String (Optional, Required on create)
- * description: String (Optional)
- * skills (Optional, Required on create): [
- * (Optional, Required on create){
- * id: String (Optional, Required on create)
- * name: String (Optional, Required on create)
- * description: String (Optional)
- * tags (Optional): [
- * String (Optional)
- * ]
- * examples (Optional): [
- * String (Optional)
- * ]
- * }
- * ]
- * }
- * }
- * }
- *
- *
+ * Get an optimization job by id.
* Response Body Schema
*
*
* {@code
* {
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
- * name: String (Required)
- * versions (Required): {
- * latest (Required): {
- * metadata (Required): {
- * String: String (Required)
- * }
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * id: String (Required)
- * name: String (Required)
- * version: String (Required)
- * description: String (Optional)
- * created_at: long (Required)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
- * }
- * }
- * status: String(creating/active/failed/deleting/deleted) (Optional)
- * instance_identity (Optional): {
- * principal_id: String (Required)
- * client_id: String (Required)
+ * inputs (Optional): {
+ * agent (Required): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * train_dataset (Required): {
+ * type: String(inline/reference) (Required)
+ * }
+ * validation_dataset (Optional): (recursive schema, see validation_dataset above)
+ * evaluators (Required): [
+ * (Required){
+ * name: String (Required)
+ * version: String (Optional)
* }
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * ]
+ * options (Optional): {
+ * max_candidates: Integer (Optional)
+ * optimization_config (Optional): {
+ * String: BinaryData (Required)
* }
- * agent_guid: String (Optional)
+ * eval_model: String (Optional)
+ * optimization_model: String (Optional)
+ * evaluation_level: String(turn/conversation) (Optional)
* }
* }
- * agent_endpoint (Optional): {
- * version_selector (Optional): {
- * version_selection_rules (Optional, Required on create): [
- * (Optional, Required on create){
- * type: String(FixedRatio) (Required)
- * agent_version: String (Optional, Required on create)
- * }
- * ]
- * }
- * protocols (Optional): [
- * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
- * ]
- * authorization_schemes (Optional): [
+ * result (Optional): {
+ * baseline: String (Optional)
+ * best: String (Optional)
+ * candidates (Optional): [
* (Optional){
- * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * candidate_id: String (Optional)
+ * name: String (Required)
+ * mutations (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * avg_score: double (Required)
+ * avg_tokens: double (Required)
+ * eval_id: String (Optional)
+ * eval_run_id: String (Optional)
+ * promotion (Optional): {
+ * promoted_at: long (Required)
+ * agent_name: String (Required)
+ * agent_version: String (Required)
+ * }
* }
* ]
* }
- * instance_identity (Optional): (recursive schema, see instance_identity above)
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
- * agent_card (Optional): {
- * version: String (Optional, Required on create)
- * description: String (Optional)
- * skills (Optional, Required on create): [
- * (Optional, Required on create){
- * id: String (Optional, Required on create)
- * name: String (Optional, Required on create)
- * description: String (Optional)
- * tags (Optional): [
- * String (Optional)
- * ]
- * examples (Optional): [
- * String (Optional)
- * ]
- * }
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
* ]
- * }
- * }
- * }
- *
- *
- * @param agentName The name of the agent to retrieve
- *
- * The name of the agent to retrieve.
- * @param patchAgentObjectRequest The patchAgentObjectRequest parameter.
- * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> updateAgentDetailsWithResponse(String agentName,
- BinaryData patchAgentObjectRequest, RequestOptions requestOptions) {
- return this.serviceClient.updateAgentDetailsWithResponseAsync(agentName, patchAgentObjectRequest,
- requestOptions);
- }
-
- /**
- * Create an agent version from code
- *
- * Creates a new agent version from code. Uploads the code zip and creates a new version
- * for an existing agent. The SHA-256 hex digest of the zip is provided in the
- * `x-ms-code-zip-sha256` header for integrity and dedup.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * metadata (Required): {
- * String: String (Required)
- * }
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * id: String (Required)
- * name: String (Required)
- * version: String (Required)
- * description: String (Optional)
- * created_at: long (Required)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
* }
* }
- * status: String(creating/active/failed/deleting/deleted) (Optional)
- * instance_identity (Optional): {
- * principal_id: String (Required)
- * client_id: String (Required)
- * }
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
- * }
- * agent_guid: String (Optional)
- * }
- * }
- *
- *
- * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
- * - Must start and end with alphanumeric characters,
- * - Can contain hyphens in the middle
- * - Must not exceed 63 characters.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- Mono> createAgentVersionFromCodeWithResponse(String agentName, String codeZipSha256,
- BinaryData content, RequestOptions requestOptions) {
- // Operation 'createAgentVersionFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable
- // and hence not generated.
- return this.serviceClient.createAgentVersionFromCodeWithResponseAsync(agentName, codeZipSha256, content,
- requestOptions);
- }
-
- /**
- * Download agent code
- *
- * Downloads the code zip for a code-based hosted agent.
- * Returns the previously-uploaded zip (`application/zip`).
- *
- * If `agent_version` is supplied, returns that version's code zip; otherwise
- * returns the latest version's code zip.
- *
- * The SHA-256 digest of the returned bytes matches the `content_hash` on the
- * resolved version's `code_configuration`.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | agent_version | String | No | The version of the agent whose code zip should be
- * downloaded.
- * If omitted, the latest version's code zip is returned. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Response Body Schema
- *
- *
- * {@code
- * BinaryData
- * }
- *
- *
- * @param agentName The name of the agent.
- * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> downloadAgentCodeWithResponse(String agentName, RequestOptions requestOptions) {
- return this.serviceClient.downloadAgentCodeWithResponseAsync(agentName, requestOptions);
- }
-
- /**
- * Create a session
- *
- * Creates a new session for an agent endpoint.
- * The endpoint resolves the backing agent version from `version_indicator` and
- * enforces session ownership using the provided isolation key for session-mutating operations.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Request Body Schema
- *
- *
- * {@code
- * {
- * agent_session_id: String (Optional)
- * version_indicator (Required): {
- * type: String(version_ref) (Required)
- * }
- * }
- * }
- *
- *
- * Response Body Schema
- *
- *
- * {@code
- * {
- * agent_session_id: String (Required)
- * version_indicator (Required): {
- * type: String(version_ref) (Required)
- * }
- * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
- * created_at: long (Required)
- * last_accessed_at: long (Required)
- * expires_at: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent to create a session for.
- * @param createSessionRequest The createSessionRequest parameter.
- * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations along with
- * {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> createSessionWithResponse(String agentName, BinaryData createSessionRequest,
- RequestOptions requestOptions) {
- return this.serviceClient.createSessionWithResponseAsync(agentName, createSessionRequest, requestOptions);
- }
-
- /**
- * Get a session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * agent_session_id: String (Required)
- * version_indicator (Required): {
- * type: String(version_ref) (Required)
- * }
- * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
- * created_at: long (Required)
- * last_accessed_at: long (Required)
- * expires_at: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier along with {@link Response}
- * on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getSessionWithResponse(String agentName, String sessionId,
- RequestOptions requestOptions) {
- return this.serviceClient.getSessionWithResponseAsync(agentName, sessionId, requestOptions);
- }
-
- /**
- * Delete a session
- *
- * Deletes a session synchronously.
- * Returns 204 No Content when the session is deleted or does not exist.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 the {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> deleteSessionWithResponse(String agentName, String sessionId,
- RequestOptions requestOptions) {
- return this.serviceClient.deleteSessionWithResponseAsync(agentName, sessionId, requestOptions);
- }
-
- /**
- * Stop a session
- *
- * Terminates the specified hosted agent session and returns 204 No Content when the request succeeds.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 the {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> stopSessionWithResponse(String agentName, String sessionId,
- RequestOptions requestOptions) {
- return this.serviceClient.stopSessionWithResponseAsync(agentName, sessionId, requestOptions);
- }
-
- /**
- * List sessions for an agent
- *
- * Returns a paged collection of sessions associated with the specified agent endpoint.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * agent_session_id: String (Required)
- * version_indicator (Required): {
- * type: String(version_ref) (Required)
- * }
- * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
* created_at: long (Required)
- * last_accessed_at: long (Required)
- * expires_at: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent.
- * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listSessions(String agentName, RequestOptions requestOptions) {
- return this.serviceClient.listSessionsAsync(agentName, requestOptions);
- }
-
- /**
- * Stream console logs for a hosted agent session
- *
- * Streams console logs (stdout / stderr) for a specific hosted agent session
- * as a Server-Sent Events (SSE) stream.
- *
- * Each SSE frame contains:
- * - `event`: always `"log"`
- * - `data`: a plain-text log line (currently JSON-formatted, but the schema
- * is not contractual and may include additional keys or change format
- * over time — clients should treat it as an opaque string)
- *
- * Example SSE frames:
- * ```
- * event: log
- * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port
- * 8088"}
- *
- * event: log
- * data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."}
- *
- * event: log
- * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"}
- *
- * event: log
- * data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"}
- * ```
- *
- * The stream remains open until the client disconnects or the server
- * terminates the connection. Clients should handle reconnection as needed.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * event: String(log) (Required)
- * data: String (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the hosted agent.
- * @param agentVersion The version of the agent.
- * @param sessionId The session ID (maps to an ADC sandbox).
- * @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 single Server-Sent Event frame emitted by the hosted agent session log stream.
- *
- * Each frame contains an `event` field identifying the event type and a `data`
- * field carrying the payload as plain text along with {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getSessionLogStreamWithResponse(String agentName, String agentVersion,
- String sessionId, RequestOptions requestOptions) {
- return this.serviceClient.getSessionLogStreamWithResponseAsync(agentName, agentVersion, sessionId,
- requestOptions);
- }
-
- /**
- * Upload a session file
- *
- * Uploads binary file content to the specified path in the session sandbox.
- * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Request Body Schema
- *
- *
- * {@code
- * BinaryData
- * }
- *
- *
- * Response Body Schema
- *
- *
- * {@code
- * {
- * path: String (Required)
- * bytes_written: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The destination file path within the sandbox, relative to the session home directory.
- * @param content The content parameter.
- * @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 response from uploading a file to a session sandbox along with {@link Response} on successful completion
- * of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> uploadSessionFileWithResponse(String agentName, String agentSessionId,
- String path, BinaryData content, RequestOptions requestOptions) {
- return this.serviceClient.uploadSessionFileWithResponseAsync(agentName, agentSessionId, path, content,
- requestOptions);
- }
-
- /**
- * Download a session file
- *
- * Downloads the file at the specified sandbox path as a binary stream.
- * The path is resolved relative to the session home directory.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Response Body Schema
- *
- *
- * {@code
- * BinaryData
- * }
- *
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file path to download from the sandbox, relative to the session home directory.
- * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> downloadSessionFileWithResponse(String agentName, String agentSessionId,
- String path, RequestOptions requestOptions) {
- return this.serviceClient.downloadSessionFileWithResponseAsync(agentName, agentSessionId, path, requestOptions);
- }
-
- /**
- * List session files
- *
- * Returns files and directories at the specified path in the session sandbox.
- * The response includes only the immediate children of the target directory and defaults to the session home
- * directory when no path is supplied.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | path | String | No | The directory path to list, relative to the session home
- * directory. Defaults to the home directory if not provided. |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * name: String (Required)
- * size: long (Required)
- * is_directory: boolean (Required)
- * modified_time: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @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 the paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listSessionFiles(String agentName, String agentSessionId,
- RequestOptions requestOptions) {
- return this.serviceClient.listSessionFilesAsync(agentName, agentSessionId, requestOptions);
- }
-
- /**
- * Delete a session file
- *
- * Deletes the specified file or directory from the session sandbox.
- * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | recursive | Boolean | No | Whether to recursively delete directory contents. The
- * service defaults to `false` if a value is not specified by the caller. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file or directory path to delete, relative to the session home directory.
- * @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 the {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> deleteSessionFileWithResponse(String agentName, String agentSessionId, String path,
- RequestOptions requestOptions) {
- return this.serviceClient.deleteSessionFileWithResponseAsync(agentName, agentSessionId, path, requestOptions);
- }
-
- /**
- * Create an agent optimization job
- *
- * Creates an agent optimization job and returns the queued job.
- * Honors `Operation-Id` for idempotent retry.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | Operation-Id | String | No | Client-generated unique ID for idempotent retries. When
- * absent, the server creates the job unconditionally. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Request Body Schema
- *
- *
- * {@code
- * {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * }
- * }
- *
- *
- * Response Body Schema
- *
- *
- * {@code
- * {
- * id: String (Required)
- * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * param: String (Optional)
- * type: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * additionalInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * debugInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * }
- * result (Optional): {
- * baseline (Optional): {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * best (Optional): (recursive schema, see best above)
- * candidates (Optional): [
- * (recursive schema, see above)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * warnings (Optional): [
- * String (Optional)
- * ]
- * all_target_attributes_failed: Boolean (Optional)
- * }
- * inputs (Optional): {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): (recursive schema, see options above)
- * }
- * created_at: long (Required)
- * updated_at: Long (Optional)
- * progress (Optional): {
- * current_iteration: int (Required)
- * best_score: double (Required)
- * elapsed_seconds: double (Required)
- * }
- * dataset (Optional): {
- * name: String (Optional)
- * version: String (Optional)
- * task_count: int (Required)
- * is_inline: boolean (Required)
- * }
- * }
- * }
- *
- *
- * @param inputs The optimization job inputs.
- * @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 agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores along with {@link Response} on successful
- * completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> createOptimizationJobWithResponse(BinaryData inputs,
- RequestOptions requestOptions) {
- return this.serviceClient.createOptimizationJobWithResponseAsync(inputs, requestOptions);
- }
-
- /**
- * Get an agent optimization job
- *
- * Retrieves the specified agent optimization job.
- * Returns 202 while the job is in progress and 200 after it reaches a terminal state.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * id: String (Required)
- * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * param: String (Optional)
- * type: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * additionalInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * debugInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * }
- * result (Optional): {
- * baseline (Optional): {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * best (Optional): (recursive schema, see best above)
- * candidates (Optional): [
- * (recursive schema, see above)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * warnings (Optional): [
- * String (Optional)
- * ]
- * all_target_attributes_failed: Boolean (Optional)
- * }
- * inputs (Optional): {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): (recursive schema, see options above)
- * }
- * created_at: long (Required)
- * updated_at: Long (Optional)
- * progress (Optional): {
- * current_iteration: int (Required)
- * best_score: double (Required)
- * elapsed_seconds: double (Required)
- * }
- * dataset (Optional): {
- * name: String (Optional)
- * version: String (Optional)
- * task_count: int (Required)
- * is_inline: boolean (Required)
- * }
- * }
- * }
- *
- *
- * @param jobId The ID of the job.
- * @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 an agent optimization job
- *
- * Retrieves the specified agent optimization job.
- * Returns 202 while the job is in progress and 200 after it reaches a terminal state along with {@link Response} on
- * successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationJobWithResponseAsync(jobId, requestOptions);
- }
-
- /**
- * List agent optimization jobs
- *
- * Returns agent optimization jobs with cursor pagination and optional lifecycle or agent filters.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- * | status | String | No | Filter to jobs in this lifecycle state. Allowed values:
- * "queued", "in_progress", "succeeded", "failed", "cancelled". |
- * | agent_name | String | No | Filter to jobs targeting this agent name. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * id: String (Required)
- * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * param: String (Optional)
- * type: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * additionalInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * debugInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * }
- * result (Optional): {
- * baseline (Optional): {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * best (Optional): (recursive schema, see best above)
- * candidates (Optional): [
- * (recursive schema, see above)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * warnings (Optional): [
- * String (Optional)
- * ]
- * all_target_attributes_failed: Boolean (Optional)
- * }
- * inputs (Optional): {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): (recursive schema, see options above)
- * }
- * created_at: long (Required)
- * updated_at: Long (Optional)
- * progress (Optional): {
- * current_iteration: int (Required)
- * best_score: double (Required)
- * elapsed_seconds: double (Required)
- * }
- * dataset (Optional): {
- * name: String (Optional)
- * version: String (Optional)
- * task_count: int (Required)
- * is_inline: boolean (Required)
- * }
- * }
- * }
- *
- *
- * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listOptimizationJobs(RequestOptions requestOptions) {
- return this.serviceClient.listOptimizationJobsAsync(requestOptions);
- }
-
- /**
- * Cancel an agent optimization job
- *
- * Requests cancellation of the specified agent optimization job.
- * The operation remains idempotent after the job reaches a terminal state.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * id: String (Required)
- * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * param: String (Optional)
- * type: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * additionalInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * debugInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * }
- * result (Optional): {
- * baseline (Optional): {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * best (Optional): (recursive schema, see best above)
- * candidates (Optional): [
- * (recursive schema, see above)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * warnings (Optional): [
- * String (Optional)
- * ]
- * all_target_attributes_failed: Boolean (Optional)
- * }
- * inputs (Optional): {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): (recursive schema, see options above)
- * }
- * created_at: long (Required)
- * updated_at: Long (Optional)
- * progress (Optional): {
- * current_iteration: int (Required)
- * best_score: double (Required)
- * elapsed_seconds: double (Required)
- * }
- * dataset (Optional): {
- * name: String (Optional)
- * version: String (Optional)
- * task_count: int (Required)
- * is_inline: boolean (Required)
- * }
- * }
- * }
- *
- *
- * @param jobId The ID of the job to cancel.
- * @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 agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores along with {@link Response} on successful
- * completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> cancelOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
- return this.serviceClient.cancelOptimizationJobWithResponseAsync(jobId, requestOptions);
- }
-
- /**
- * Delete an agent optimization job
- *
- * Deletes the specified agent optimization job and its candidate artifacts.
- * Cancels the job first when it is still in a non-terminal state.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | force | Boolean | No | When true, force-delete even if the job is in a non-terminal
- * state. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- *
- * @param jobId The ID of the job 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 the {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> deleteOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
- return this.serviceClient.deleteOptimizationJobWithResponseAsync(jobId, requestOptions);
- }
-
- /**
- * List optimization job candidates
- *
- * Returns the candidates produced by the specified optimization job.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listOptimizationCandidates(String jobId, RequestOptions requestOptions) {
- return this.serviceClient.listOptimizationCandidatesAsync(jobId, requestOptions);
- }
-
- /**
- * Get an optimization candidate
- *
- * Retrieves metadata, manifest information, and promotion details for the specified candidate.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * candidate_id: String (Required)
- * job_id: String (Required)
- * candidate_name: String (Required)
- * status: String (Required)
- * score: Double (Optional)
- * has_results: boolean (Required)
- * created_at: long (Required)
- * updated_at: long (Required)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * files (Required): [
- * (Required){
- * path: String (Required)
- * type: String (Required)
- * size_bytes: long (Required)
- * }
- * ]
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 an optimization candidate
- *
- * Retrieves metadata, manifest information, and promotion details for the specified candidate along with
- * {@link Response} on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getOptimizationCandidateWithResponse(String jobId, String candidateId,
- RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationCandidateWithResponseAsync(jobId, candidateId, requestOptions);
- }
-
- /**
- * Get an optimization candidate config
- *
- * Retrieves the deploy configuration JSON for the specified candidate.
- * Clients can use it to compose `agents.create_version(...)` requests.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * instructions: String (Optional)
- * model: String (Optional)
- * temperature: Double (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 an optimization candidate config
- *
- * Retrieves the deploy configuration JSON for the specified candidate.
- * Clients can use it to compose `agents.create_version(...)` requests along with {@link Response} on successful
- * completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getOptimizationCandidateConfigWithResponse(String jobId, String candidateId,
- RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationCandidateConfigWithResponseAsync(jobId, candidateId, requestOptions);
- }
-
- /**
- * Get optimization candidate results
- *
- * Retrieves full per-task evaluation results for the specified candidate.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * candidate_id: String (Required)
- * results (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 optimization candidate results
- *
- * Retrieves full per-task evaluation results for the specified candidate along with {@link Response} on successful
- * completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getOptimizationCandidateResultsWithResponse(String jobId, String candidateId,
- RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationCandidateResultsWithResponseAsync(jobId, candidateId, requestOptions);
- }
-
- /**
- * Get an optimization candidate file
- *
- * Streams the specified file from the candidate's blob directory.
- * Response Body Schema
- *
- *
- * {@code
- * BinaryData
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @param path Relative path of the file to download (e.g. 'files/examples.jsonl').
- * @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 an optimization candidate file
- *
- * Streams the specified file from the candidate's blob directory along with {@link Response} on successful
- * completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getOptimizationCandidateFileWithResponse(String jobId, String candidateId,
- String path, RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationCandidateFileWithResponseAsync(jobId, candidateId, path,
- requestOptions);
- }
-
- /**
- * Promote an optimization candidate
- *
- * Promotes the specified candidate and records the deployment timestamp and target agent version.
- * Request Body Schema
- *
- *
- * {@code
- * {
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- *
- *
- * Response Body Schema
- *
- *
- * {@code
- * {
- * candidate_id: String (Required)
- * status: String (Required)
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id to promote.
- * @param candidateRequest Promotion details.
- * @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 response after successfully promoting a candidate along with {@link Response} on successful completion of
- * {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> promoteOptimizationCandidateWithResponse(String jobId, String candidateId,
- BinaryData candidateRequest, RequestOptions requestOptions) {
- return this.serviceClient.promoteOptimizationCandidateWithResponseAsync(jobId, candidateId, candidateRequest,
- requestOptions);
- }
-
- /**
- * Create a new code-based agent
- *
- * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
- * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
- * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- *
- * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
- * hyphens allowed in the middle.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response body on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- Mono createAgentFromCode(String agentName, String codeZipSha256, CreateAgentFromCodeContent content) {
- // Generated convenience method for createAgentFromCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return createAgentFromCodeWithResponse(agentName, codeZipSha256,
- new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
- .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
- content.getCode().getFilename())
- .end()
- .getRequestBody(),
- requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(AgentDetails.class));
- }
-
- /**
- * Update a code-based agent
- *
- * Updates a code-based agent by uploading new code and creating a new version.
- * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- *
- * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
- * - Must start and end with alphanumeric characters,
- * - Can contain hyphens in the middle
- * - Must not exceed 63 characters.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response body on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono updateAgentFromCode(String agentName, String codeZipSha256,
- CreateAgentVersionFromCodeContent content) {
- // Generated convenience method for updateAgentFromCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return updateAgentFromCodeWithResponse(agentName, codeZipSha256,
- new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
- .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
- content.getCode().getFilename())
- .end()
- .getRequestBody(),
- requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(AgentDetails.class));
- }
-
- /**
- * Update an agent endpoint
- *
- * Applies a merge-patch update to the specified agent endpoint configuration.
- *
- * @param agentName The name of the agent to retrieve
- *
- * The name of the agent to retrieve.
- * @param patchAgentObjectRequest The patchAgentObjectRequest parameter.
- * @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 the response body on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono updateAgentDetails(String agentName, UpdateAgentDetailsOptions patchAgentObjectRequest) {
- // Generated convenience method for updateAgentDetailsWithResponse
- RequestOptions requestOptions = new RequestOptions();
- JsonMergePatchHelper.getUpdateAgentDetailsOptionsAccessor()
- .prepareModelForJsonMergePatch(patchAgentObjectRequest, true);
- BinaryData patchAgentObjectRequestInBinaryData = BinaryData.fromObject(patchAgentObjectRequest);
- // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
- patchAgentObjectRequestInBinaryData.getLength();
- JsonMergePatchHelper.getUpdateAgentDetailsOptionsAccessor()
- .prepareModelForJsonMergePatch(patchAgentObjectRequest, false);
- return updateAgentDetailsWithResponse(agentName, patchAgentObjectRequestInBinaryData, requestOptions)
- .flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(AgentDetails.class));
- }
-
- /**
- * Create an agent version from code
- *
- * Creates a new agent version from code. Uploads the code zip and creates a new version
- * for an existing agent. The SHA-256 hex digest of the zip is provided in the
- * `x-ms-code-zip-sha256` header for integrity and dedup.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- *
- * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
- * - Must start and end with alphanumeric characters,
- * - Can contain hyphens in the middle
- * - Must not exceed 63 characters.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response body on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono createAgentVersionFromCode(String agentName, String codeZipSha256,
- CreateAgentVersionFromCodeContent content) {
- // Generated convenience method for createAgentVersionFromCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return createAgentVersionFromCodeWithResponse(agentName, codeZipSha256,
- new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
- .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
- content.getCode().getFilename())
- .end()
- .getRequestBody(),
- requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(AgentVersionDetails.class));
- }
-
- /**
- * Download agent code
- *
- * Downloads the code zip for a code-based hosted agent.
- * Returns the previously-uploaded zip (`application/zip`).
- *
- * If `agent_version` is supplied, returns that version's code zip; otherwise
- * returns the latest version's code zip.
- *
- * The SHA-256 digest of the returned bytes matches the `content_hash` on the
- * resolved version's `code_configuration`.
- *
- * @param agentName The name of the agent.
- * @param agentVersion The version of the agent whose code zip should be downloaded.
- * If omitted, the latest version's code zip is returned.
- * @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 the response body on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono downloadAgentCode(String agentName, String agentVersion) {
- // Generated convenience method for downloadAgentCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (agentVersion != null) {
- requestOptions.addQueryParam("agent_version", agentVersion, false);
- }
- return downloadAgentCodeWithResponse(agentName, requestOptions).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Download agent code
- *
- * Downloads the code zip for a code-based hosted agent.
- * Returns the previously-uploaded zip (`application/zip`).
- *
- * If `agent_version` is supplied, returns that version's code zip; otherwise
- * returns the latest version's code zip.
- *
- * The SHA-256 digest of the returned bytes matches the `content_hash` on the
- * resolved version's `code_configuration`.
- *
- * @param agentName The name of the agent.
- * @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 the response body on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono downloadAgentCode(String agentName) {
- // Generated convenience method for downloadAgentCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return downloadAgentCodeWithResponse(agentName, requestOptions).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Create a session
- *
- * Creates a new session for an agent endpoint.
- * The endpoint resolves the backing agent version from `version_indicator` and
- * enforces session ownership using the provided isolation key for session-mutating operations.
- *
- * @param agentName The name of the agent to create a session for.
- * @param versionIndicator Determines which agent version backs the session.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @param agentSessionId Optional caller-provided session ID. If specified, it must be unique within the agent
- * endpoint. Auto-generated if omitted.
- * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations on successful
- * completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono createSession(String agentName, VersionIndicator versionIndicator,
- String userIsolationKey, String agentSessionId) {
- // Generated convenience method for createSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- CreateSessionRequest createSessionRequestObj
- = new CreateSessionRequest(versionIndicator).setAgentSessionId(agentSessionId);
- BinaryData createSessionRequest = BinaryData.fromObject(createSessionRequestObj);
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return createSessionWithResponse(agentName, createSessionRequest, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class));
- }
-
- /**
- * Create a session
- *
- * Creates a new session for an agent endpoint.
- * The endpoint resolves the backing agent version from `version_indicator` and
- * enforces session ownership using the provided isolation key for session-mutating operations.
- *
- * @param agentName The name of the agent to create a session for.
- * @param versionIndicator Determines which agent version backs the session.
- * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations on successful
- * completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono createSession(String agentName, VersionIndicator versionIndicator) {
- // Generated convenience method for createSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- CreateSessionRequest createSessionRequestObj = new CreateSessionRequest(versionIndicator);
- BinaryData createSessionRequest = BinaryData.fromObject(createSessionRequestObj);
- return createSessionWithResponse(agentName, createSessionRequest, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class));
- }
-
- /**
- * Get a session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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 session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier on successful completion of
- * {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getSession(String agentName, String sessionId, String userIsolationKey) {
- // Generated convenience method for getSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return getSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class));
- }
-
- /**
- * Get a session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier on successful completion of
- * {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getSession(String agentName, String sessionId) {
- // Generated convenience method for getSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return getSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class));
- }
-
- /**
- * Delete a session
- *
- * Deletes a session synchronously.
- * Returns 204 No Content when the session is deleted or does not exist.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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 {@link Mono} that completes when a successful response is received.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono deleteSession(String agentName, String sessionId, String userIsolationKey) {
- // Generated convenience method for deleteSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return deleteSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Delete a session
- *
- * Deletes a session synchronously.
- * Returns 204 No Content when the session is deleted or does not exist.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 {@link Mono} that completes when a successful response is received.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono deleteSession(String agentName, String sessionId) {
- // Generated convenience method for deleteSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return deleteSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Stop a session
- *
- * Terminates the specified hosted agent session and returns 204 No Content when the request succeeds.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 {@link Mono} that completes when a successful response is received.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono stopSession(String agentName, String sessionId) {
- // Generated convenience method for stopSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return stopSessionWithResponse(agentName, sessionId, requestOptions).flatMap(FluxUtil::toMono);
- }
-
- /**
- * List sessions for an agent
- *
- * Returns a paged collection of sessions associated with the specified agent endpoint.
- *
- * @param agentName The name of the agent.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
- * default is 20.
- * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
- * for descending order.
- * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list.
- * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
- * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listSessions(String agentName, String userIsolationKey, Integer limit,
- PageOrder order, String after, String before) {
- // Generated convenience method for listSessions
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- if (limit != null) {
- requestOptions.addQueryParam("limit", String.valueOf(limit), false);
- }
- if (order != null) {
- requestOptions.addQueryParam("order", order.toString(), false);
- }
- if (after != null) {
- requestOptions.addQueryParam("after", after, false);
- }
- if (before != null) {
- requestOptions.addQueryParam("before", before, false);
- }
- PagedFlux pagedFluxResponse = listSessions(agentName, requestOptions);
- return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
- Flux> flux = (continuationTokenParam == null)
- ? pagedFluxResponse.byPage().take(1)
- : pagedFluxResponse.byPage(continuationTokenParam).take(1);
- return flux
- .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
- pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
- pagedResponse.getValue()
- .stream()
- .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class))
- .collect(Collectors.toList()),
- pagedResponse.getContinuationToken(), null));
- });
- }
-
- /**
- * List sessions for an agent
- *
- * Returns a paged collection of sessions associated with the specified agent endpoint.
- *
- * @param agentName The name of the agent.
- * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listSessions(String agentName) {
- // Generated convenience method for listSessions
- RequestOptions requestOptions = new RequestOptions();
- PagedFlux pagedFluxResponse = listSessions(agentName, requestOptions);
- return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
- Flux> flux = (continuationTokenParam == null)
- ? pagedFluxResponse.byPage().take(1)
- : pagedFluxResponse.byPage(continuationTokenParam).take(1);
- return flux
- .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
- pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
- pagedResponse.getValue()
- .stream()
- .map(protocolMethodData -> protocolMethodData.toObject(AgentSessionResource.class))
- .collect(Collectors.toList()),
- pagedResponse.getContinuationToken(), null));
- });
- }
-
- /**
- * Upload a session file
- *
- * Uploads binary file content to the specified path in the session sandbox.
- * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The destination file path within the sandbox, relative to the session home directory.
- * @param content The content parameter.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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 response from uploading a file to a session sandbox on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono uploadSessionFile(String agentName, String agentSessionId, String path,
- BinaryData content, String userIsolationKey) {
- // Generated convenience method for uploadSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return uploadSessionFileWithResponse(agentName, agentSessionId, path, content, requestOptions)
- .flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(SessionFileWriteResult.class));
- }
-
- /**
- * Upload a session file
- *
- * Uploads binary file content to the specified path in the session sandbox.
- * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The destination file path within the sandbox, relative to the session home directory.
- * @param content The content parameter.
- * @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 response from uploading a file to a session sandbox on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono uploadSessionFile(String agentName, String agentSessionId, String path,
- BinaryData content) {
- // Generated convenience method for uploadSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return uploadSessionFileWithResponse(agentName, agentSessionId, path, content, requestOptions)
- .flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(SessionFileWriteResult.class));
- }
-
- /**
- * Download a session file
- *
- * Downloads the file at the specified sandbox path as a binary stream.
- * The path is resolved relative to the session home directory.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file path to download from the sandbox, relative to the session home directory.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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 the response body on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono downloadSessionFile(String agentName, String agentSessionId, String path,
- String userIsolationKey) {
- // Generated convenience method for downloadSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions)
- .flatMap(FluxUtil::toMono);
- }
-
- /**
- * Download a session file
- *
- * Downloads the file at the specified sandbox path as a binary stream.
- * The path is resolved relative to the session home directory.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file path to download from the sandbox, relative to the session home directory.
- * @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 the response body on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono downloadSessionFile(String agentName, String agentSessionId, String path) {
- // Generated convenience method for downloadSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions)
- .flatMap(FluxUtil::toMono);
- }
-
- /**
- * List session files
- *
- * Returns files and directories at the specified path in the session sandbox.
- * The response includes only the immediate children of the target directory and defaults to the session home
- * directory when no path is supplied.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The directory path to list, relative to the session home directory. Defaults to the home directory if
- * not provided.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
- * default is 20.
- * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
- * for descending order.
- * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list.
- * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
- * @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 the paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listSessionFiles(String agentName, String agentSessionId, String path,
- String userIsolationKey, Integer limit, PageOrder order, String after, String before) {
- // Generated convenience method for listSessionFiles
- RequestOptions requestOptions = new RequestOptions();
- if (path != null) {
- requestOptions.addQueryParam("path", path, false);
- }
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- if (limit != null) {
- requestOptions.addQueryParam("limit", String.valueOf(limit), false);
- }
- if (order != null) {
- requestOptions.addQueryParam("order", order.toString(), false);
- }
- if (after != null) {
- requestOptions.addQueryParam("after", after, false);
- }
- if (before != null) {
- requestOptions.addQueryParam("before", before, false);
- }
- PagedFlux pagedFluxResponse = listSessionFiles(agentName, agentSessionId, requestOptions);
- return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
- Flux> flux = (continuationTokenParam == null)
- ? pagedFluxResponse.byPage().take(1)
- : pagedFluxResponse.byPage(continuationTokenParam).take(1);
- return flux
- .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
- pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
- pagedResponse.getValue()
- .stream()
- .map(protocolMethodData -> protocolMethodData.toObject(SessionDirectoryEntry.class))
- .collect(Collectors.toList()),
- pagedResponse.getContinuationToken(), null));
- });
- }
-
- /**
- * List session files
- *
- * Returns files and directories at the specified path in the session sandbox.
- * The response includes only the immediate children of the target directory and defaults to the session home
- * directory when no path is supplied.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @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 the paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listSessionFiles(String agentName, String agentSessionId) {
- // Generated convenience method for listSessionFiles
- RequestOptions requestOptions = new RequestOptions();
- PagedFlux pagedFluxResponse = listSessionFiles(agentName, agentSessionId, requestOptions);
- return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
- Flux> flux = (continuationTokenParam == null)
- ? pagedFluxResponse.byPage().take(1)
- : pagedFluxResponse.byPage(continuationTokenParam).take(1);
- return flux
- .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
- pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
- pagedResponse.getValue()
- .stream()
- .map(protocolMethodData -> protocolMethodData.toObject(SessionDirectoryEntry.class))
- .collect(Collectors.toList()),
- pagedResponse.getContinuationToken(), null));
- });
- }
-
- /**
- * Delete a session file
- *
- * Deletes the specified file or directory from the session sandbox.
- * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file or directory path to delete, relative to the session home directory.
- * @param recursive Whether to recursively delete directory contents. The service defaults to `false` if a value is
- * not specified by the caller.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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 {@link Mono} that completes when a successful response is received.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono deleteSessionFile(String agentName, String agentSessionId, String path, Boolean recursive,
- String userIsolationKey) {
- // Generated convenience method for deleteSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (recursive != null) {
- requestOptions.addQueryParam("recursive", String.valueOf(recursive), false);
- }
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Delete a session file
- *
- * Deletes the specified file or directory from the session sandbox.
- * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file or directory path to delete, relative to the session home directory.
- * @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 {@link Mono} that completes when a successful response is received.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono deleteSessionFile(String agentName, String agentSessionId, String path) {
- // Generated convenience method for deleteSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Create an agent optimization job
- *
- * Creates an agent optimization job and returns the queued job.
- * Honors `Operation-Id` for idempotent retry.
- *
- * @param inputs The optimization job inputs.
- * @param operationId Client-generated unique ID for idempotent retries. When absent, the server creates the job
- * unconditionally.
- * @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 agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono createOptimizationJob(OptimizationJobInputs inputs, String operationId) {
- // Generated convenience method for createOptimizationJobWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (operationId != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("Operation-Id"), operationId);
- }
- return createOptimizationJobWithResponse(BinaryData.fromObject(inputs), requestOptions)
- .flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class));
- }
-
- /**
- * Create an agent optimization job
- *
- * Creates an agent optimization job and returns the queued job.
- * Honors `Operation-Id` for idempotent retry.
- *
- * @param inputs The optimization job inputs.
- * @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 agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores on successful completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono createOptimizationJob(OptimizationJobInputs inputs) {
- // Generated convenience method for createOptimizationJobWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return createOptimizationJobWithResponse(BinaryData.fromObject(inputs), requestOptions)
- .flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class));
- }
-
- /**
- * Get an agent optimization job
- *
- * Retrieves the specified agent optimization job.
- * Returns 202 while the job is in progress and 200 after it reaches a terminal state.
- *
- * @param jobId The ID of the job.
- * @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 an agent optimization job
- *
- * Retrieves the specified agent optimization job.
- * Returns 202 while the job is in progress and 200 after it reaches a terminal state on successful completion of
- * {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getOptimizationJob(String jobId) {
- // Generated convenience method for getOptimizationJobWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return getOptimizationJobWithResponse(jobId, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class));
- }
-
- /**
- * List agent optimization jobs
- *
- * Returns agent optimization jobs with cursor pagination and optional lifecycle or agent filters.
- *
- * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
- * default is 20.
- * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
- * for descending order.
- * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list.
- * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
- * @param status Filter to jobs in this lifecycle state.
- * @param agentName Filter to jobs targeting this agent name.
- * @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listOptimizationJobs(Integer limit, PageOrder order, String after, String before,
- JobStatus status, String agentName) {
- // Generated convenience method for listOptimizationJobs
- RequestOptions requestOptions = new RequestOptions();
- if (limit != null) {
- requestOptions.addQueryParam("limit", String.valueOf(limit), false);
- }
- if (order != null) {
- requestOptions.addQueryParam("order", order.toString(), false);
- }
- if (after != null) {
- requestOptions.addQueryParam("after", after, false);
- }
- if (before != null) {
- requestOptions.addQueryParam("before", before, false);
- }
- if (status != null) {
- requestOptions.addQueryParam("status", status.toString(), false);
- }
- if (agentName != null) {
- requestOptions.addQueryParam("agent_name", agentName, false);
- }
- PagedFlux pagedFluxResponse = listOptimizationJobs(requestOptions);
- return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
- Flux> flux = (continuationTokenParam == null)
- ? pagedFluxResponse.byPage().take(1)
- : pagedFluxResponse.byPage(continuationTokenParam).take(1);
- return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
- pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
- pagedResponse.getValue()
- .stream()
- .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class))
- .collect(Collectors.toList()),
- pagedResponse.getContinuationToken(), null));
- });
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
+ * }
+ * warnings (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * @param jobId The ID of the job.
+ * @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 info about an agent optimization job.
+ *
+ * Get an optimization job by id along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
+ return this.serviceClient.getOptimizationJobWithResponseAsync(jobId, requestOptions);
}
/**
- * List agent optimization jobs
+ * Returns a list of agent optimization jobs.
*
- * Returns agent optimization jobs with cursor pagination and optional lifecycle or agent filters.
+ * List optimization jobs. Supports cursor pagination and optional status / agent_name filters.
+ * Query Parameters
+ *
+ * Query Parameters
+ * | Name | Type | Required | Description |
+ * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
+ * between 1 and 100, and the
+ * default is 20. |
+ * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
+ * for ascending order and`desc`
+ * for descending order. Allowed values: "asc", "desc". |
+ * | after | String | No | A cursor for use in pagination. `after` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
+ * | before | String | No | A cursor for use in pagination. `before` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
+ * | status | String | No | Filter to jobs in this lifecycle state. Allowed values:
+ * "queued", "in_progress", "succeeded", "failed", "cancelled". |
+ * | agent_name | String | No | Filter to jobs targeting this agent name. |
+ *
+ * You can add these to a request with {@link RequestOptions#addQueryParam}
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * }
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
+ * }
+ * agent (Optional): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * }
+ * }
+ *
*
+ * @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.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response data for a requested list of items as paginated response with {@link PagedFlux}.
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listOptimizationJobs() {
- // Generated convenience method for listOptimizationJobs
- RequestOptions requestOptions = new RequestOptions();
- PagedFlux pagedFluxResponse = listOptimizationJobs(requestOptions);
- return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
- Flux> flux = (continuationTokenParam == null)
- ? pagedFluxResponse.byPage().take(1)
- : pagedFluxResponse.byPage(continuationTokenParam).take(1);
- return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
- pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
- pagedResponse.getValue()
- .stream()
- .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class))
- .collect(Collectors.toList()),
- pagedResponse.getContinuationToken(), null));
- });
+ public PagedFlux listOptimizationJobs(RequestOptions requestOptions) {
+ return this.serviceClient.listOptimizationJobsAsync(requestOptions);
}
/**
- * Cancel an agent optimization job
+ * Cancels an agent optimization job.
*
- * Requests cancellation of the specified agent optimization job.
- * The operation remains idempotent after the job reaches a terminal state.
+ * Request cancellation of a running or queued job. Returns an error if the job is already in a terminal state.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * inputs (Optional): {
+ * agent (Required): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * train_dataset (Required): {
+ * type: String(inline/reference) (Required)
+ * }
+ * validation_dataset (Optional): (recursive schema, see validation_dataset above)
+ * evaluators (Required): [
+ * (Required){
+ * name: String (Required)
+ * version: String (Optional)
+ * }
+ * ]
+ * options (Optional): {
+ * max_candidates: Integer (Optional)
+ * optimization_config (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * eval_model: String (Optional)
+ * optimization_model: String (Optional)
+ * evaluation_level: String(turn/conversation) (Optional)
+ * }
+ * }
+ * result (Optional): {
+ * baseline: String (Optional)
+ * best: String (Optional)
+ * candidates (Optional): [
+ * (Optional){
+ * candidate_id: String (Optional)
+ * name: String (Required)
+ * mutations (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * avg_score: double (Required)
+ * avg_tokens: double (Required)
+ * eval_id: String (Optional)
+ * eval_run_id: String (Optional)
+ * promotion (Optional): {
+ * promoted_at: long (Required)
+ * agent_name: String (Required)
+ * agent_version: String (Required)
+ * }
+ * }
+ * ]
+ * }
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * }
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
+ * }
+ * warnings (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * }
+ *
*
* @param jobId The ID of the job to cancel.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @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.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores on successful completion of {@link Mono}.
+ * (instructions, model, skills, tools) to maximize evaluation scores along with {@link Response} on successful
+ * completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono cancelOptimizationJob(String jobId) {
- // Generated convenience method for cancelOptimizationJobWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return cancelOptimizationJobWithResponse(jobId, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class));
+ public Mono> cancelOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
+ return this.serviceClient.cancelOptimizationJobWithResponseAsync(jobId, requestOptions);
}
/**
- * Delete an agent optimization job
+ * Deletes an agent optimization job.
*
- * Deletes the specified agent optimization job and its candidate artifacts.
- * Cancels the job first when it is still in a non-terminal state.
+ * Delete the job and its candidate artifacts. Cancels first if non-terminal.
*
* @param jobId The ID of the job to delete.
- * @param force When true, force-delete even if the job is in a non-terminal state.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @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.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return A {@link Mono} that completes when a successful response is received.
+ * @return the {@link Response} on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono deleteOptimizationJob(String jobId, Boolean force) {
- // Generated convenience method for deleteOptimizationJobWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (force != null) {
- requestOptions.addQueryParam("force", String.valueOf(force), false);
- }
- return deleteOptimizationJobWithResponse(jobId, requestOptions).flatMap(FluxUtil::toMono);
+ public Mono> deleteOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteOptimizationJobWithResponseAsync(jobId, requestOptions);
}
/**
- * Delete an agent optimization job
+ * Get info about an agent optimization job.
*
- * Deletes the specified agent optimization job and its candidate artifacts.
- * Cancels the job first when it is still in a non-terminal state.
+ * Get an optimization job by id.
*
- * @param jobId The ID of the job to delete.
+ * @param jobId The ID of the job.
* @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 {@link Mono} that completes when a successful response is received.
+ * @return info about an agent optimization job.
+ *
+ * Get an optimization job by id on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono deleteOptimizationJob(String jobId) {
- // Generated convenience method for deleteOptimizationJobWithResponse
+ public Mono getOptimizationJob(String jobId) {
+ // Generated convenience method for getOptimizationJobWithResponse
RequestOptions requestOptions = new RequestOptions();
- return deleteOptimizationJobWithResponse(jobId, requestOptions).flatMap(FluxUtil::toMono);
+ return getOptimizationJobWithResponse(jobId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class));
}
/**
- * List optimization job candidates
+ * Returns a list of agent optimization jobs.
*
- * Returns the candidates produced by the specified optimization job.
+ * List optimization jobs. Supports cursor pagination and optional status / agent_name filters.
*
- * @param jobId The optimization job id.
* @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
* default is 20.
* @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
@@ -3109,6 +585,8 @@ public Mono deleteOptimizationJob(String jobId) {
* @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
* For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
* subsequent call can include before=obj_foo in order to fetch the previous page of the list.
+ * @param status Filter to jobs in this lifecycle state.
+ * @param agentName Filter to jobs targeting this agent name.
* @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.
@@ -3119,9 +597,9 @@ public Mono deleteOptimizationJob(String jobId) {
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listOptimizationCandidates(String jobId, Integer limit, PageOrder order,
- String after, String before) {
- // Generated convenience method for listOptimizationCandidates
+ public PagedFlux listOptimizationJobs(Integer limit, PageOrder order, String after,
+ String before, JobStatus status, String agentName) {
+ // Generated convenience method for listOptimizationJobs
RequestOptions requestOptions = new RequestOptions();
if (limit != null) {
requestOptions.addQueryParam("limit", String.valueOf(limit), false);
@@ -3135,29 +613,33 @@ public PagedFlux listOptimizationCandidates(String jobId,
if (before != null) {
requestOptions.addQueryParam("before", before, false);
}
- PagedFlux pagedFluxResponse = listOptimizationCandidates(jobId, requestOptions);
+ if (status != null) {
+ requestOptions.addQueryParam("status", status.toString(), false);
+ }
+ if (agentName != null) {
+ requestOptions.addQueryParam("agent_name", agentName, false);
+ }
+ PagedFlux pagedFluxResponse = listOptimizationJobs(requestOptions);
return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
Flux> flux = (continuationTokenParam == null)
? pagedFluxResponse.byPage().take(1)
: pagedFluxResponse.byPage(continuationTokenParam).take(1);
return flux
- .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
+ .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
pagedResponse.getValue()
.stream()
- .map(protocolMethodData -> protocolMethodData.toObject(OptimizationCandidate.class))
+ .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJobListItem.class))
.collect(Collectors.toList()),
pagedResponse.getContinuationToken(), null));
});
}
/**
- * List optimization job candidates
+ * Returns a list of agent optimization jobs.
*
- * Returns the candidates produced by the specified optimization job.
+ * List optimization jobs. Supports cursor pagination and optional status / agent_name filters.
*
- * @param jobId The optimization job id.
- * @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.
@@ -3167,190 +649,121 @@ public PagedFlux listOptimizationCandidates(String jobId,
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listOptimizationCandidates(String jobId) {
- // Generated convenience method for listOptimizationCandidates
+ public PagedFlux listOptimizationJobs() {
+ // Generated convenience method for listOptimizationJobs
RequestOptions requestOptions = new RequestOptions();
- PagedFlux pagedFluxResponse = listOptimizationCandidates(jobId, requestOptions);
+ PagedFlux pagedFluxResponse = listOptimizationJobs(requestOptions);
return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
Flux> flux = (continuationTokenParam == null)
? pagedFluxResponse.byPage().take(1)
: pagedFluxResponse.byPage(continuationTokenParam).take(1);
return flux
- .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
+ .map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(),
pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
pagedResponse.getValue()
.stream()
- .map(protocolMethodData -> protocolMethodData.toObject(OptimizationCandidate.class))
+ .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJobListItem.class))
.collect(Collectors.toList()),
pagedResponse.getContinuationToken(), null));
});
}
/**
- * Get an optimization candidate
- *
- * Retrieves metadata, manifest information, and promotion details for the specified candidate.
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 an optimization candidate
- *
- * Retrieves metadata, manifest information, and promotion details for the specified candidate on successful
- * completion of {@link Mono}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getOptimizationCandidate(String jobId, String candidateId) {
- // Generated convenience method for getOptimizationCandidateWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return getOptimizationCandidateWithResponse(jobId, candidateId, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(CandidateMetadata.class));
- }
-
- /**
- * Get an optimization candidate config
+ * Cancels an agent optimization job.
*
- * Retrieves the deploy configuration JSON for the specified candidate.
- * Clients can use it to compose `agents.create_version(...)` requests.
+ * Request cancellation of a running or queued job. Returns an error if the job is already in a terminal state.
*
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
+ * @param jobId The ID of the job to cancel.
* @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 an optimization candidate config
- *
- * Retrieves the deploy configuration JSON for the specified candidate.
- * Clients can use it to compose `agents.create_version(...)` requests on successful completion of {@link Mono}.
+ * @return agent optimization job resource — a long-running job that optimizes an agent's configuration
+ * (instructions, model, skills, tools) to maximize evaluation scores on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getOptimizationCandidateConfig(String jobId, String candidateId) {
- // Generated convenience method for getOptimizationCandidateConfigWithResponse
+ public Mono cancelOptimizationJob(String jobId) {
+ // Generated convenience method for cancelOptimizationJobWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getOptimizationCandidateConfigWithResponse(jobId, candidateId, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(CandidateDeployConfig.class));
+ return cancelOptimizationJobWithResponse(jobId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class));
}
/**
- * Get optimization candidate results
+ * Deletes an agent optimization job.
*
- * Retrieves full per-task evaluation results for the specified candidate.
+ * Delete the job and its candidate artifacts. Cancels first if non-terminal.
*
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
+ * @param jobId The ID of the job 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 optimization candidate results
- *
- * Retrieves full per-task evaluation results for the specified candidate on successful completion of {@link Mono}.
+ * @return A {@link Mono} that completes when a successful response is received.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getOptimizationCandidateResults(String jobId, String candidateId) {
- // Generated convenience method for getOptimizationCandidateResultsWithResponse
+ public Mono deleteOptimizationJob(String jobId) {
+ // Generated convenience method for deleteOptimizationJobWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getOptimizationCandidateResultsWithResponse(jobId, candidateId, requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(CandidateResults.class));
+ return deleteOptimizationJobWithResponse(jobId, requestOptions).flatMap(FluxUtil::toMono);
}
/**
- * Get an optimization candidate file
+ * Creates an agent optimization job.
*
- * Streams the specified file from the candidate's blob directory.
+ * Create an optimization job. Returns 201 with the queued job. Honours `Operation-Id` for idempotent retry.
*
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @param path Relative path of the file to download (e.g. 'files/examples.jsonl').
+ * @param job The job to create.
+ * @param operationId Client-generated unique ID for idempotent retries. When absent, the server creates the job
+ * unconditionally.
* @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 an optimization candidate file
- *
- * Streams the specified file from the candidate's blob directory on successful completion of {@link Mono}.
+ * @return agent optimization job resource — a long-running job that optimizes an agent's configuration
+ * (instructions, model, skills, tools) to maximize evaluation scores on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getOptimizationCandidateFile(String jobId, String candidateId, String path) {
- // Generated convenience method for getOptimizationCandidateFileWithResponse
+ public Mono createOptimizationJob(OptimizationJob job, String operationId) {
+ // Generated convenience method for createOptimizationJobWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getOptimizationCandidateFileWithResponse(jobId, candidateId, path, requestOptions)
- .flatMap(FluxUtil::toMono);
+ if (operationId != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("Operation-Id"), operationId);
+ }
+ return createOptimizationJobWithResponse(BinaryData.fromObject(job), requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class));
}
/**
- * Promote an optimization candidate
+ * Creates an agent optimization job.
*
- * Promotes the specified candidate and records the deployment timestamp and target agent version.
+ * Create an optimization job. Returns 201 with the queued job. Honours `Operation-Id` for idempotent retry.
*
- * @param jobId The optimization job id.
- * @param candidateId The candidate id to promote.
- * @param candidateRequest Promotion details.
+ * @param job The job to create.
* @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 response after successfully promoting a candidate on successful completion of {@link Mono}.
+ * @return agent optimization job resource — a long-running job that optimizes an agent's configuration
+ * (instructions, model, skills, tools) to maximize evaluation scores on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono promoteOptimizationCandidate(String jobId, String candidateId,
- PromoteCandidateInput candidateRequest) {
- // Generated convenience method for promoteOptimizationCandidateWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return promoteOptimizationCandidateWithResponse(jobId, candidateId, BinaryData.fromObject(candidateRequest),
- requestOptions).flatMap(FluxUtil::toMono)
- .map(protocolMethodData -> protocolMethodData.toObject(PromoteCandidateResult.class));
- }
-
- /**
- * Streams console logs (stdout / stderr) for a specific hosted agent session as typed
- * {@link SessionLogEvent} values.
- *
- * @param agentName The name of the hosted agent.
- * @param agentVersion The version of the agent.
- * @param sessionId The session ID (maps to an ADC sandbox).
- * @return A stream of {@link SessionLogEvent} values emitted by the hosted agent session log stream.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public Flux getSessionLogStream(String agentName, String agentVersion, String sessionId) {
+ public Mono createOptimizationJob(OptimizationJob job) {
+ // Generated convenience method for createOptimizationJobWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getSessionLogStream(agentName, agentVersion, sessionId, requestOptions);
- }
-
- /**
- * Streams console logs (stdout / stderr) for a specific hosted agent session as typed
- * {@link SessionLogEvent} values.
- *
- * @param agentName The name of the hosted agent.
- * @param agentVersion The version of the agent.
- * @param sessionId The session ID (maps to an ADC sandbox).
- * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
- * @return A stream of {@link SessionLogEvent} values emitted by the hosted agent session log stream.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public Flux getSessionLogStream(String agentName, String agentVersion, String sessionId,
- RequestOptions requestOptions) {
- return SessionLogStreamHelper
- .parse(getSessionLogStreamWithResponse(agentName, agentVersion, sessionId, requestOptions)
- .flatMapMany(response -> response.getValue().toFluxByteBuffer()));
+ return createOptimizationJobWithResponse(BinaryData.fromObject(job), requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(OptimizationJob.class));
}
}
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaAgentsClient.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaAgentsClient.java
index 1231e3f60178..7dc8c04b36de 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaAgentsClient.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaAgentsClient.java
@@ -4,31 +4,11 @@
package com.azure.ai.agents;
import com.azure.ai.agents.implementation.BetaAgentsImpl;
-import com.azure.ai.agents.implementation.JsonMergePatchHelper;
-import com.azure.ai.agents.implementation.MultipartFormDataHelper;
-import com.azure.ai.agents.implementation.SessionLogStreamHelper;
-import com.azure.ai.agents.implementation.models.CreateAgentFromCodeContent;
-import com.azure.ai.agents.implementation.models.CreateSessionRequest;
import com.azure.ai.agents.implementation.utils.Beta;
-import com.azure.ai.agents.models.AgentDetails;
-import com.azure.ai.agents.models.AgentSessionResource;
-import com.azure.ai.agents.models.AgentVersionDetails;
-import com.azure.ai.agents.models.CandidateDeployConfig;
-import com.azure.ai.agents.models.CandidateMetadata;
-import com.azure.ai.agents.models.CandidateResults;
-import com.azure.ai.agents.models.CreateAgentVersionFromCodeContent;
import com.azure.ai.agents.models.JobStatus;
-import com.azure.ai.agents.models.OptimizationCandidate;
import com.azure.ai.agents.models.OptimizationJob;
-import com.azure.ai.agents.models.OptimizationJobInputs;
+import com.azure.ai.agents.models.OptimizationJobListItem;
import com.azure.ai.agents.models.PageOrder;
-import com.azure.ai.agents.models.PromoteCandidateInput;
-import com.azure.ai.agents.models.PromoteCandidateResult;
-import com.azure.ai.agents.models.SessionDirectoryEntry;
-import com.azure.ai.agents.models.SessionFileWriteResult;
-import com.azure.ai.agents.models.SessionLogEvent;
-import com.azure.ai.agents.models.UpdateAgentDetailsOptions;
-import com.azure.ai.agents.models.VersionIndicator;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
@@ -42,7 +22,6 @@
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;
-import com.azure.core.util.IterableStream;
/**
* Initializes a new instance of the synchronous AgentsClient type.
@@ -65,2751 +44,503 @@ public final class BetaAgentsClient {
}
/**
- * Create a new code-based agent
+ * Creates an agent optimization job.
*
- * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
- * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
- * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- * Response Body Schema
+ * Create an optimization job. Returns 201 with the queued job. Honours `Operation-Id` for idempotent retry.
+ * Header Parameters
+ *
+ * Header Parameters
+ * | Name | Type | Required | Description |
+ * | Operation-Id | String | No | Client-generated unique ID for idempotent retries. When
+ * absent, the server creates the job unconditionally. |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Request Body Schema
*
*
* {@code
* {
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
- * name: String (Required)
- * versions (Required): {
- * latest (Required): {
- * metadata (Required): {
- * String: String (Required)
- * }
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * id: String (Required)
- * name: String (Required)
- * version: String (Required)
- * description: String (Optional)
- * created_at: long (Required)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
- * }
- * }
- * status: String(creating/active/failed/deleting/deleted) (Optional)
- * instance_identity (Optional): {
- * principal_id: String (Required)
- * client_id: String (Required)
+ * inputs (Optional): {
+ * agent (Required): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * train_dataset (Required): {
+ * type: String(inline/reference) (Required)
+ * }
+ * validation_dataset (Optional): (recursive schema, see validation_dataset above)
+ * evaluators (Required): [
+ * (Required){
+ * name: String (Required)
+ * version: String (Optional)
* }
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * ]
+ * options (Optional): {
+ * max_candidates: Integer (Optional)
+ * optimization_config (Optional): {
+ * String: BinaryData (Required)
* }
- * agent_guid: String (Optional)
+ * eval_model: String (Optional)
+ * optimization_model: String (Optional)
+ * evaluation_level: String(turn/conversation) (Optional)
* }
* }
- * agent_endpoint (Optional): {
- * version_selector (Optional): {
- * version_selection_rules (Optional, Required on create): [
- * (Optional, Required on create){
- * type: String(FixedRatio) (Required)
- * agent_version: String (Optional, Required on create)
- * }
- * ]
- * }
- * protocols (Optional): [
- * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
- * ]
- * authorization_schemes (Optional): [
+ * result (Optional): {
+ * baseline: String (Optional)
+ * best: String (Optional)
+ * candidates (Optional): [
* (Optional){
- * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * candidate_id: String (Optional)
+ * name: String (Required)
+ * mutations (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * avg_score: double (Required)
+ * avg_tokens: double (Required)
+ * eval_id: String (Optional)
+ * eval_run_id: String (Optional)
+ * promotion (Optional): {
+ * promoted_at: long (Required)
+ * agent_name: String (Required)
+ * agent_version: String (Required)
+ * }
* }
* ]
* }
- * instance_identity (Optional): (recursive schema, see instance_identity above)
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
- * agent_card (Optional): {
- * version: String (Optional, Required on create)
- * description: String (Optional)
- * skills (Optional, Required on create): [
- * (Optional, Required on create){
- * id: String (Optional, Required on create)
- * name: String (Optional, Required on create)
- * description: String (Optional)
- * tags (Optional): [
- * String (Optional)
- * ]
- * examples (Optional): [
- * String (Optional)
- * ]
- * }
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
* ]
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
* }
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
+ * }
+ * warnings (Optional): [
+ * String (Optional)
+ * ]
* }
* }
*
- *
- * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
- * hyphens allowed in the middle.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response body along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- Response createAgentFromCodeWithResponse(String agentName, String codeZipSha256, BinaryData content,
- RequestOptions requestOptions) {
- // Operation 'createAgentFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable and
- // hence not generated.
- return this.serviceClient.createAgentFromCodeWithResponse(agentName, codeZipSha256, content, requestOptions);
- }
-
- /**
- * Update a code-based agent
- *
- * Updates a code-based agent by uploading new code and creating a new version.
- * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
+ *
* Response Body Schema
*
*
* {@code
* {
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
- * name: String (Required)
- * versions (Required): {
- * latest (Required): {
- * metadata (Required): {
- * String: String (Required)
- * }
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * id: String (Required)
- * name: String (Required)
- * version: String (Required)
- * description: String (Optional)
- * created_at: long (Required)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
- * }
- * }
- * status: String(creating/active/failed/deleting/deleted) (Optional)
- * instance_identity (Optional): {
- * principal_id: String (Required)
- * client_id: String (Required)
+ * inputs (Optional): {
+ * agent (Required): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * train_dataset (Required): {
+ * type: String(inline/reference) (Required)
+ * }
+ * validation_dataset (Optional): (recursive schema, see validation_dataset above)
+ * evaluators (Required): [
+ * (Required){
+ * name: String (Required)
+ * version: String (Optional)
* }
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * ]
+ * options (Optional): {
+ * max_candidates: Integer (Optional)
+ * optimization_config (Optional): {
+ * String: BinaryData (Required)
* }
- * agent_guid: String (Optional)
+ * eval_model: String (Optional)
+ * optimization_model: String (Optional)
+ * evaluation_level: String(turn/conversation) (Optional)
* }
* }
- * agent_endpoint (Optional): {
- * version_selector (Optional): {
- * version_selection_rules (Optional, Required on create): [
- * (Optional, Required on create){
- * type: String(FixedRatio) (Required)
- * agent_version: String (Optional, Required on create)
- * }
- * ]
- * }
- * protocols (Optional): [
- * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
- * ]
- * authorization_schemes (Optional): [
+ * result (Optional): {
+ * baseline: String (Optional)
+ * best: String (Optional)
+ * candidates (Optional): [
* (Optional){
- * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * candidate_id: String (Optional)
+ * name: String (Required)
+ * mutations (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * avg_score: double (Required)
+ * avg_tokens: double (Required)
+ * eval_id: String (Optional)
+ * eval_run_id: String (Optional)
+ * promotion (Optional): {
+ * promoted_at: long (Required)
+ * agent_name: String (Required)
+ * agent_version: String (Required)
+ * }
* }
* ]
* }
- * instance_identity (Optional): (recursive schema, see instance_identity above)
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
- * agent_card (Optional): {
- * version: String (Optional, Required on create)
- * description: String (Optional)
- * skills (Optional, Required on create): [
- * (Optional, Required on create){
- * id: String (Optional, Required on create)
- * name: String (Optional, Required on create)
- * description: String (Optional)
- * tags (Optional): [
- * String (Optional)
- * ]
- * examples (Optional): [
- * String (Optional)
- * ]
- * }
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
* ]
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * }
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
* }
+ * warnings (Optional): [
+ * String (Optional)
+ * ]
* }
* }
*
*
- * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
- * - Must start and end with alphanumeric characters,
- * - Can contain hyphens in the middle
- * - Must not exceed 63 characters.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
+ * @param job The job to create.
* @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 the response body along with {@link Response}.
+ * @return agent optimization job resource — a long-running job that optimizes an agent's configuration
+ * (instructions, model, skills, tools) to maximize evaluation scores along with {@link Response}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Response updateAgentFromCodeWithResponse(String agentName, String codeZipSha256, BinaryData content,
- RequestOptions requestOptions) {
- // Operation 'updateAgentFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable and
- // hence not generated.
- return this.serviceClient.updateAgentFromCodeWithResponse(agentName, codeZipSha256, content, requestOptions);
+ public Response createOptimizationJobWithResponse(BinaryData job, RequestOptions requestOptions) {
+ return this.serviceClient.createOptimizationJobWithResponse(job, requestOptions);
}
/**
- * Update an agent endpoint
+ * Get info about an agent optimization job.
*
- * Applies a merge-patch update to the specified agent endpoint configuration.
- * Request Body Schema
- *
- *
- * {@code
- * {
- * agent_endpoint (Optional): {
- * version_selector (Optional): {
- * version_selection_rules (Optional, Required on create): [
- * (Optional, Required on create){
- * type: String(FixedRatio) (Required)
- * agent_version: String (Optional, Required on create)
- * }
- * ]
- * }
- * protocols (Optional): [
- * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
- * ]
- * authorization_schemes (Optional): [
- * (Optional){
- * type: String(Entra/BotService/BotServiceRbac) (Required)
- * }
- * ]
- * }
- * agent_card (Optional): {
- * version: String (Optional, Required on create)
- * description: String (Optional)
- * skills (Optional, Required on create): [
- * (Optional, Required on create){
- * id: String (Optional, Required on create)
- * name: String (Optional, Required on create)
- * description: String (Optional)
- * tags (Optional): [
- * String (Optional)
- * ]
- * examples (Optional): [
- * String (Optional)
- * ]
- * }
- * ]
- * }
- * }
- * }
- *
- *
+ * Get an optimization job by id.
* Response Body Schema
*
*
* {@code
* {
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
- * name: String (Required)
- * versions (Required): {
- * latest (Required): {
- * metadata (Required): {
- * String: String (Required)
- * }
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * id: String (Required)
- * name: String (Required)
- * version: String (Required)
- * description: String (Optional)
- * created_at: long (Required)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
- * }
- * }
- * status: String(creating/active/failed/deleting/deleted) (Optional)
- * instance_identity (Optional): {
- * principal_id: String (Required)
- * client_id: String (Required)
+ * inputs (Optional): {
+ * agent (Required): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * train_dataset (Required): {
+ * type: String(inline/reference) (Required)
+ * }
+ * validation_dataset (Optional): (recursive schema, see validation_dataset above)
+ * evaluators (Required): [
+ * (Required){
+ * name: String (Required)
+ * version: String (Optional)
* }
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * ]
+ * options (Optional): {
+ * max_candidates: Integer (Optional)
+ * optimization_config (Optional): {
+ * String: BinaryData (Required)
* }
- * agent_guid: String (Optional)
+ * eval_model: String (Optional)
+ * optimization_model: String (Optional)
+ * evaluation_level: String(turn/conversation) (Optional)
* }
* }
- * agent_endpoint (Optional): {
- * version_selector (Optional): {
- * version_selection_rules (Optional, Required on create): [
- * (Optional, Required on create){
- * type: String(FixedRatio) (Required)
- * agent_version: String (Optional, Required on create)
- * }
- * ]
- * }
- * protocols (Optional): [
- * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
- * ]
- * authorization_schemes (Optional): [
+ * result (Optional): {
+ * baseline: String (Optional)
+ * best: String (Optional)
+ * candidates (Optional): [
* (Optional){
- * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * candidate_id: String (Optional)
+ * name: String (Required)
+ * mutations (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * avg_score: double (Required)
+ * avg_tokens: double (Required)
+ * eval_id: String (Optional)
+ * eval_run_id: String (Optional)
+ * promotion (Optional): {
+ * promoted_at: long (Required)
+ * agent_name: String (Required)
+ * agent_version: String (Required)
+ * }
* }
* ]
* }
- * instance_identity (Optional): (recursive schema, see instance_identity above)
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
- * agent_card (Optional): {
- * version: String (Optional, Required on create)
- * description: String (Optional)
- * skills (Optional, Required on create): [
- * (Optional, Required on create){
- * id: String (Optional, Required on create)
- * name: String (Optional, Required on create)
- * description: String (Optional)
- * tags (Optional): [
- * String (Optional)
- * ]
- * examples (Optional): [
- * String (Optional)
- * ]
- * }
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
* ]
- * }
- * }
- * }
- *
- *
- * @param agentName The name of the agent to retrieve
- *
- * The name of the agent to retrieve.
- * @param patchAgentObjectRequest The patchAgentObjectRequest parameter.
- * @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 the response body along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response updateAgentDetailsWithResponse(String agentName, BinaryData patchAgentObjectRequest,
- RequestOptions requestOptions) {
- return this.serviceClient.updateAgentDetailsWithResponse(agentName, patchAgentObjectRequest, requestOptions);
- }
-
- /**
- * Create an agent version from code
- *
- * Creates a new agent version from code. Uploads the code zip and creates a new version
- * for an existing agent. The SHA-256 hex digest of the zip is provided in the
- * `x-ms-code-zip-sha256` header for integrity and dedup.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * metadata (Required): {
- * String: String (Required)
- * }
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * id: String (Required)
- * name: String (Required)
- * version: String (Required)
- * description: String (Optional)
- * created_at: long (Required)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
* }
* }
- * status: String(creating/active/failed/deleting/deleted) (Optional)
- * instance_identity (Optional): {
- * principal_id: String (Required)
- * client_id: String (Required)
- * }
- * blueprint (Optional): (recursive schema, see blueprint above)
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
* }
- * agent_guid: String (Optional)
+ * warnings (Optional): [
+ * String (Optional)
+ * ]
* }
* }
*
*
- * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
- * - Must start and end with alphanumeric characters,
- * - Can contain hyphens in the middle
- * - Must not exceed 63 characters.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
+ * @param jobId The ID of the job.
* @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 the response body along with {@link Response}.
+ * @return info about an agent optimization job.
+ *
+ * Get an optimization job by id along with {@link Response}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Response createAgentVersionFromCodeWithResponse(String agentName, String codeZipSha256,
- BinaryData content, RequestOptions requestOptions) {
- // Operation 'createAgentVersionFromCode' is of content-type 'multipart/form-data'. Protocol API is not usable
- // and hence not generated.
- return this.serviceClient.createAgentVersionFromCodeWithResponse(agentName, codeZipSha256, content,
- requestOptions);
+ public Response getOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
+ return this.serviceClient.getOptimizationJobWithResponse(jobId, requestOptions);
}
/**
- * Download agent code
+ * Returns a list of agent optimization jobs.
*
- * Downloads the code zip for a code-based hosted agent.
- * Returns the previously-uploaded zip (`application/zip`).
- *
- * If `agent_version` is supplied, returns that version's code zip; otherwise
- * returns the latest version's code zip.
- *
- * The SHA-256 digest of the returned bytes matches the `content_hash` on the
- * resolved version's `code_configuration`.
+ * List optimization jobs. Supports cursor pagination and optional status / agent_name filters.
* Query Parameters
*
* Query Parameters
* | Name | Type | Required | Description |
- * | agent_version | String | No | The version of the agent whose code zip should be
- * downloaded.
- * If omitted, the latest version's code zip is returned. |
+ * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
+ * between 1 and 100, and the
+ * default is 20. |
+ * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
+ * for ascending order and`desc`
+ * for descending order. Allowed values: "asc", "desc". |
+ * | after | String | No | A cursor for use in pagination. `after` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
+ * | before | String | No | A cursor for use in pagination. `before` is an object ID that
+ * defines your place in the list.
+ * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
+ * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
+ * | status | String | No | Filter to jobs in this lifecycle state. Allowed values:
+ * "queued", "in_progress", "succeeded", "failed", "cancelled". |
+ * | agent_name | String | No | Filter to jobs targeting this agent name. |
*
* You can add these to a request with {@link RequestOptions#addQueryParam}
* Response Body Schema
*
*
* {@code
- * BinaryData
- * }
- *
- *
- * @param agentName The name of the agent.
- * @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 the response body along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response downloadAgentCodeWithResponse(String agentName, RequestOptions requestOptions) {
- return this.serviceClient.downloadAgentCodeWithResponse(agentName, requestOptions);
- }
-
- /**
- * Create a session
- *
- * Creates a new session for an agent endpoint.
- * The endpoint resolves the backing agent version from `version_indicator` and
- * enforces session ownership using the provided isolation key for session-mutating operations.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Request Body Schema
- *
- *
- * {@code
* {
- * agent_session_id: String (Optional)
- * version_indicator (Required): {
- * type: String(version_ref) (Required)
- * }
- * }
- * }
- *
- *
- * Response Body Schema
- *
- *
- * {@code
- * {
- * agent_session_id: String (Required)
- * version_indicator (Required): {
- * type: String(version_ref) (Required)
- * }
- * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
- * created_at: long (Required)
- * last_accessed_at: long (Required)
- * expires_at: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent to create a session for.
- * @param createSessionRequest The createSessionRequest parameter.
- * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations along with
- * {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response createSessionWithResponse(String agentName, BinaryData createSessionRequest,
- RequestOptions requestOptions) {
- return this.serviceClient.createSessionWithResponse(agentName, createSessionRequest, requestOptions);
- }
-
- /**
- * Get a session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * agent_session_id: String (Required)
- * version_indicator (Required): {
- * type: String(version_ref) (Required)
- * }
- * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
- * created_at: long (Required)
- * last_accessed_at: long (Required)
- * expires_at: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getSessionWithResponse(String agentName, String sessionId,
- RequestOptions requestOptions) {
- return this.serviceClient.getSessionWithResponse(agentName, sessionId, requestOptions);
- }
-
- /**
- * Delete a session
- *
- * Deletes a session synchronously.
- * Returns 204 No Content when the session is deleted or does not exist.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 the {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response deleteSessionWithResponse(String agentName, String sessionId, RequestOptions requestOptions) {
- return this.serviceClient.deleteSessionWithResponse(agentName, sessionId, requestOptions);
- }
-
- /**
- * Stop a session
- *
- * Terminates the specified hosted agent session and returns 204 No Content when the request succeeds.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 the {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response stopSessionWithResponse(String agentName, String sessionId, RequestOptions requestOptions) {
- return this.serviceClient.stopSessionWithResponse(agentName, sessionId, requestOptions);
- }
-
- /**
- * List sessions for an agent
- *
- * Returns a paged collection of sessions associated with the specified agent endpoint.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * agent_session_id: String (Required)
- * version_indicator (Required): {
- * type: String(version_ref) (Required)
+ * id: String (Required)
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
* }
- * status: String(creating/active/idle/updating/failed/deleting/deleted/expired) (Required)
- * created_at: long (Required)
- * last_accessed_at: long (Required)
- * expires_at: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent.
- * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listSessions(String agentName, RequestOptions requestOptions) {
- return this.serviceClient.listSessions(agentName, requestOptions);
- }
-
- /**
- * Stream console logs for a hosted agent session
- *
- * Streams console logs (stdout / stderr) for a specific hosted agent session
- * as a Server-Sent Events (SSE) stream.
- *
- * Each SSE frame contains:
- * - `event`: always `"log"`
- * - `data`: a plain-text log line (currently JSON-formatted, but the schema
- * is not contractual and may include additional keys or change format
- * over time — clients should treat it as an opaque string)
- *
- * Example SSE frames:
- * ```
- * event: log
- * data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port
- * 8088"}
- *
- * event: log
- * data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."}
- *
- * event: log
- * data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"}
- *
- * event: log
- * data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"}
- * ```
- *
- * The stream remains open until the client disconnects or the server
- * terminates the connection. Clients should handle reconnection as needed.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * event: String(log) (Required)
- * data: String (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the hosted agent.
- * @param agentVersion The version of the agent.
- * @param sessionId The session ID (maps to an ADC sandbox).
- * @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 single Server-Sent Event frame emitted by the hosted agent session log stream.
- *
- * Each frame contains an `event` field identifying the event type and a `data`
- * field carrying the payload as plain text along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getSessionLogStreamWithResponse(String agentName, String agentVersion, String sessionId,
- RequestOptions requestOptions) {
- return this.serviceClient.getSessionLogStreamWithResponse(agentName, agentVersion, sessionId, requestOptions);
- }
-
- /**
- * Upload a session file
- *
- * Uploads binary file content to the specified path in the session sandbox.
- * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Request Body Schema
- *
- *
- * {@code
- * BinaryData
- * }
- *
- *
- * Response Body Schema
- *
- *
- * {@code
- * {
- * path: String (Required)
- * bytes_written: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The destination file path within the sandbox, relative to the session home directory.
- * @param content The content parameter.
- * @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 response from uploading a file to a session sandbox along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response uploadSessionFileWithResponse(String agentName, String agentSessionId, String path,
- BinaryData content, RequestOptions requestOptions) {
- return this.serviceClient.uploadSessionFileWithResponse(agentName, agentSessionId, path, content,
- requestOptions);
- }
-
- /**
- * Download a session file
- *
- * Downloads the file at the specified sandbox path as a binary stream.
- * The path is resolved relative to the session home directory.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Response Body Schema
- *
- *
- * {@code
- * BinaryData
- * }
- *
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file path to download from the sandbox, relative to the session home directory.
- * @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 the response body along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response downloadSessionFileWithResponse(String agentName, String agentSessionId, String path,
- RequestOptions requestOptions) {
- return this.serviceClient.downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions);
- }
-
- /**
- * List session files
- *
- * Returns files and directories at the specified path in the session sandbox.
- * The response includes only the immediate children of the target directory and defaults to the session home
- * directory when no path is supplied.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | path | String | No | The directory path to list, relative to the session home
- * directory. Defaults to the home directory if not provided. |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * name: String (Required)
- * size: long (Required)
- * is_directory: boolean (Required)
- * modified_time: long (Required)
- * }
- * }
- *
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @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 the paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listSessionFiles(String agentName, String agentSessionId,
- RequestOptions requestOptions) {
- return this.serviceClient.listSessionFiles(agentName, agentSessionId, requestOptions);
- }
-
- /**
- * Delete a session file
- *
- * Deletes the specified file or directory from the session sandbox.
- * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | recursive | Boolean | No | Whether to recursively delete directory contents. The
- * service defaults to `false` if a value is not specified by the caller. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | x-ms-user-isolation-key | String | No | Opaque per-user isolation key used to scope
- * endpoint-scoped data (responses, conversations, sessions) to a specific end user. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file or directory path to delete, relative to the session home directory.
- * @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 the {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response deleteSessionFileWithResponse(String agentName, String agentSessionId, String path,
- RequestOptions requestOptions) {
- return this.serviceClient.deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions);
- }
-
- /**
- * Create an agent optimization job
- *
- * Creates an agent optimization job and returns the queued job.
- * Honors `Operation-Id` for idempotent retry.
- * Header Parameters
- *
- * Header Parameters
- * | Name | Type | Required | Description |
- * | Operation-Id | String | No | Client-generated unique ID for idempotent retries. When
- * absent, the server creates the job unconditionally. |
- *
- * You can add these to a request with {@link RequestOptions#addHeader}
- * Request Body Schema
- *
- *
- * {@code
- * {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * }
- * }
- *
- *
- * Response Body Schema
- *
- *
- * {@code
- * {
- * id: String (Required)
- * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * param: String (Optional)
- * type: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * additionalInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * debugInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * }
- * result (Optional): {
- * baseline (Optional): {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * best (Optional): (recursive schema, see best above)
- * candidates (Optional): [
- * (recursive schema, see above)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * warnings (Optional): [
- * String (Optional)
- * ]
- * all_target_attributes_failed: Boolean (Optional)
- * }
- * inputs (Optional): {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): (recursive schema, see options above)
- * }
- * created_at: long (Required)
- * updated_at: Long (Optional)
- * progress (Optional): {
- * current_iteration: int (Required)
- * best_score: double (Required)
- * elapsed_seconds: double (Required)
- * }
- * dataset (Optional): {
- * name: String (Optional)
- * version: String (Optional)
- * task_count: int (Required)
- * is_inline: boolean (Required)
- * }
- * }
- * }
- *
- *
- * @param inputs The optimization job inputs.
- * @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 agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response createOptimizationJobWithResponse(BinaryData inputs, RequestOptions requestOptions) {
- return this.serviceClient.createOptimizationJobWithResponse(inputs, requestOptions);
- }
-
- /**
- * Get an agent optimization job
- *
- * Retrieves the specified agent optimization job.
- * Returns 202 while the job is in progress and 200 after it reaches a terminal state.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * id: String (Required)
- * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * param: String (Optional)
- * type: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * additionalInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * debugInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * }
- * result (Optional): {
- * baseline (Optional): {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * best (Optional): (recursive schema, see best above)
- * candidates (Optional): [
- * (recursive schema, see above)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * warnings (Optional): [
- * String (Optional)
- * ]
- * all_target_attributes_failed: Boolean (Optional)
- * }
- * inputs (Optional): {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): (recursive schema, see options above)
- * }
- * created_at: long (Required)
- * updated_at: Long (Optional)
- * progress (Optional): {
- * current_iteration: int (Required)
- * best_score: double (Required)
- * elapsed_seconds: double (Required)
- * }
- * dataset (Optional): {
- * name: String (Optional)
- * version: String (Optional)
- * task_count: int (Required)
- * is_inline: boolean (Required)
- * }
- * }
- * }
- *
- *
- * @param jobId The ID of the job.
- * @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 an agent optimization job
- *
- * Retrieves the specified agent optimization job.
- * Returns 202 while the job is in progress and 200 after it reaches a terminal state along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationJobWithResponse(jobId, requestOptions);
- }
-
- /**
- * List agent optimization jobs
- *
- * Returns agent optimization jobs with cursor pagination and optional lifecycle or agent filters.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- * | status | String | No | Filter to jobs in this lifecycle state. Allowed values:
- * "queued", "in_progress", "succeeded", "failed", "cancelled". |
- * | agent_name | String | No | Filter to jobs targeting this agent name. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * id: String (Required)
- * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * param: String (Optional)
- * type: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * additionalInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * debugInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * }
- * result (Optional): {
- * baseline (Optional): {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * best (Optional): (recursive schema, see best above)
- * candidates (Optional): [
- * (recursive schema, see above)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * warnings (Optional): [
- * String (Optional)
- * ]
- * all_target_attributes_failed: Boolean (Optional)
- * }
- * inputs (Optional): {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): (recursive schema, see options above)
- * }
- * created_at: long (Required)
- * updated_at: Long (Optional)
- * progress (Optional): {
- * current_iteration: int (Required)
- * best_score: double (Required)
- * elapsed_seconds: double (Required)
- * }
- * dataset (Optional): {
- * name: String (Optional)
- * version: String (Optional)
- * task_count: int (Required)
- * is_inline: boolean (Required)
- * }
- * }
- * }
- *
- *
- * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listOptimizationJobs(RequestOptions requestOptions) {
- return this.serviceClient.listOptimizationJobs(requestOptions);
- }
-
- /**
- * Cancel an agent optimization job
- *
- * Requests cancellation of the specified agent optimization job.
- * The operation remains idempotent after the job reaches a terminal state.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * id: String (Required)
- * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * param: String (Optional)
- * type: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * additionalInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * debugInfo (Optional): {
- * String: BinaryData (Required)
- * }
- * }
- * result (Optional): {
- * baseline (Optional): {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * best (Optional): (recursive schema, see best above)
- * candidates (Optional): [
- * (recursive schema, see above)
- * ]
- * options (Optional): {
- * max_iterations: Integer (Optional)
- * optimization_config (Optional): {
- * String: BinaryData (Required)
- * }
- * eval_model: String (Optional)
- * optimization_model: String (Optional)
- * evaluation_level: String(turn/conversation) (Optional)
- * }
- * warnings (Optional): [
- * String (Optional)
- * ]
- * all_target_attributes_failed: Boolean (Optional)
- * }
- * inputs (Optional): {
- * agent (Required): {
- * agent_name: String (Required)
- * agent_version: String (Optional)
- * }
- * train_dataset_reference (Required): {
- * name: String (Required)
- * version: String (Optional)
- * }
- * validation_dataset_reference (Optional): (recursive schema, see validation_dataset_reference above)
- * evaluators (Optional): [
- * String (Optional)
- * ]
- * options (Optional): (recursive schema, see options above)
- * }
- * created_at: long (Required)
- * updated_at: Long (Optional)
- * progress (Optional): {
- * current_iteration: int (Required)
- * best_score: double (Required)
- * elapsed_seconds: double (Required)
- * }
- * dataset (Optional): {
- * name: String (Optional)
- * version: String (Optional)
- * task_count: int (Required)
- * is_inline: boolean (Required)
- * }
- * }
- * }
- *
- *
- * @param jobId The ID of the job to cancel.
- * @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 agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response cancelOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
- return this.serviceClient.cancelOptimizationJobWithResponse(jobId, requestOptions);
- }
-
- /**
- * Delete an agent optimization job
- *
- * Deletes the specified agent optimization job and its candidate artifacts.
- * Cancels the job first when it is still in a non-terminal state.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | force | Boolean | No | When true, force-delete even if the job is in a non-terminal
- * state. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- *
- * @param jobId The ID of the job 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 the {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response deleteOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
- return this.serviceClient.deleteOptimizationJobWithResponse(jobId, requestOptions);
- }
-
- /**
- * List optimization job candidates
- *
- * Returns the candidates produced by the specified optimization job.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * candidate_id: String (Optional)
- * name: String (Required)
- * config (Required): {
- * agent_name: String (Optional)
- * agent_version: String (Optional)
- * model: String (Optional)
- * system_prompt: String (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * mutations (Required): {
- * String: BinaryData (Required)
- * }
- * avg_score: double (Required)
- * avg_tokens: double (Required)
- * pass_rate: double (Required)
- * task_scores (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * is_pareto_optimal: boolean (Required)
- * eval_id: String (Optional)
- * eval_run_id: String (Optional)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listOptimizationCandidates(String jobId, RequestOptions requestOptions) {
- return this.serviceClient.listOptimizationCandidates(jobId, requestOptions);
- }
-
- /**
- * Get an optimization candidate
- *
- * Retrieves metadata, manifest information, and promotion details for the specified candidate.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * candidate_id: String (Required)
- * job_id: String (Required)
- * candidate_name: String (Required)
- * status: String (Required)
- * score: Double (Optional)
- * has_results: boolean (Required)
- * created_at: long (Required)
- * updated_at: long (Required)
- * promotion (Optional): {
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * files (Required): [
- * (Required){
- * path: String (Required)
- * type: String (Required)
- * size_bytes: long (Required)
- * }
- * ]
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 an optimization candidate
- *
- * Retrieves metadata, manifest information, and promotion details for the specified candidate along with
- * {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getOptimizationCandidateWithResponse(String jobId, String candidateId,
- RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationCandidateWithResponse(jobId, candidateId, requestOptions);
- }
-
- /**
- * Get an optimization candidate config
- *
- * Retrieves the deploy configuration JSON for the specified candidate.
- * Clients can use it to compose `agents.create_version(...)` requests.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * instructions: String (Optional)
- * model: String (Optional)
- * temperature: Double (Optional)
- * skills (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * tools (Optional): [
- * (Optional){
- * String: BinaryData (Required)
- * }
- * ]
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 an optimization candidate config
- *
- * Retrieves the deploy configuration JSON for the specified candidate.
- * Clients can use it to compose `agents.create_version(...)` requests along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getOptimizationCandidateConfigWithResponse(String jobId, String candidateId,
- RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationCandidateConfigWithResponse(jobId, candidateId, requestOptions);
- }
-
- /**
- * Get optimization candidate results
- *
- * Retrieves full per-task evaluation results for the specified candidate.
- * Response Body Schema
- *
- *
- * {@code
- * {
- * candidate_id: String (Required)
- * results (Required): [
- * (Required){
- * task_name: String (Required)
- * query: String (Optional)
- * scores (Required): {
- * String: double (Required)
- * }
- * composite_score: double (Required)
- * tokens: long (Required)
- * duration_seconds: double (Required)
- * passed: boolean (Required)
- * error_message: String (Optional)
- * rationales (Optional): {
- * String: String (Required)
- * }
- * response: String (Optional)
- * run_id: String (Optional)
- * }
- * ]
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 optimization candidate results
- *
- * Retrieves full per-task evaluation results for the specified candidate along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getOptimizationCandidateResultsWithResponse(String jobId, String candidateId,
- RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationCandidateResultsWithResponse(jobId, candidateId, requestOptions);
- }
-
- /**
- * Get an optimization candidate file
- *
- * Streams the specified file from the candidate's blob directory.
- * Response Body Schema
- *
- *
- * {@code
- * BinaryData
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @param path Relative path of the file to download (e.g. 'files/examples.jsonl').
- * @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 an optimization candidate file
- *
- * Streams the specified file from the candidate's blob directory along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getOptimizationCandidateFileWithResponse(String jobId, String candidateId, String path,
- RequestOptions requestOptions) {
- return this.serviceClient.getOptimizationCandidateFileWithResponse(jobId, candidateId, path, requestOptions);
- }
-
- /**
- * Promote an optimization candidate
- *
- * Promotes the specified candidate and records the deployment timestamp and target agent version.
- * Request Body Schema
- *
- *
- * {@code
- * {
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- *
- *
- * Response Body Schema
- *
- *
- * {@code
- * {
- * candidate_id: String (Required)
- * status: String (Required)
- * promoted_at: long (Required)
- * agent_name: String (Required)
- * agent_version: String (Required)
- * }
- * }
- *
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id to promote.
- * @param candidateRequest Promotion details.
- * @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 response after successfully promoting a candidate along with {@link Response}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response promoteOptimizationCandidateWithResponse(String jobId, String candidateId,
- BinaryData candidateRequest, RequestOptions requestOptions) {
- return this.serviceClient.promoteOptimizationCandidateWithResponse(jobId, candidateId, candidateRequest,
- requestOptions);
- }
-
- /**
- * Create a new code-based agent
- *
- * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
- * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
- * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- *
- * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
- * hyphens allowed in the middle.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- AgentDetails createAgentFromCode(String agentName, String codeZipSha256, CreateAgentFromCodeContent content) {
- // Generated convenience method for createAgentFromCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return createAgentFromCodeWithResponse(agentName, codeZipSha256,
- new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
- .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
- content.getCode().getFilename())
- .end()
- .getRequestBody(),
- requestOptions).getValue().toObject(AgentDetails.class);
- }
-
- /**
- * Update a code-based agent
- *
- * Updates a code-based agent by uploading new code and creating a new version.
- * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- *
- * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
- * - Must start and end with alphanumeric characters,
- * - Can contain hyphens in the middle
- * - Must not exceed 63 characters.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AgentDetails updateAgentFromCode(String agentName, String codeZipSha256,
- CreateAgentVersionFromCodeContent content) {
- // Generated convenience method for updateAgentFromCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return updateAgentFromCodeWithResponse(agentName, codeZipSha256,
- new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
- .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
- content.getCode().getFilename())
- .end()
- .getRequestBody(),
- requestOptions).getValue().toObject(AgentDetails.class);
- }
-
- /**
- * Update an agent endpoint
- *
- * Applies a merge-patch update to the specified agent endpoint configuration.
- *
- * @param agentName The name of the agent to retrieve
- *
- * The name of the agent to retrieve.
- * @param patchAgentObjectRequest The patchAgentObjectRequest parameter.
- * @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 the response.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AgentDetails updateAgentDetails(String agentName, UpdateAgentDetailsOptions patchAgentObjectRequest) {
- // Generated convenience method for updateAgentDetailsWithResponse
- RequestOptions requestOptions = new RequestOptions();
- JsonMergePatchHelper.getUpdateAgentDetailsOptionsAccessor()
- .prepareModelForJsonMergePatch(patchAgentObjectRequest, true);
- BinaryData patchAgentObjectRequestInBinaryData = BinaryData.fromObject(patchAgentObjectRequest);
- // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
- patchAgentObjectRequestInBinaryData.getLength();
- JsonMergePatchHelper.getUpdateAgentDetailsOptionsAccessor()
- .prepareModelForJsonMergePatch(patchAgentObjectRequest, false);
- return updateAgentDetailsWithResponse(agentName, patchAgentObjectRequestInBinaryData, requestOptions).getValue()
- .toObject(AgentDetails.class);
- }
-
- /**
- * Create an agent version from code
- *
- * Creates a new agent version from code. Uploads the code zip and creates a new version
- * for an existing agent. The SHA-256 hex digest of the zip is provided in the
- * `x-ms-code-zip-sha256` header for integrity and dedup.
- * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
- * irrelevant).
- * Maximum upload size is 250 MB.
- *
- * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
- * - Must start and end with alphanumeric characters,
- * - Can contain hyphens in the middle
- * - Must not exceed 63 characters.
- * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
- * verification.
- * @param content The content parameter.
- * @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 the response.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AgentVersionDetails createAgentVersionFromCode(String agentName, String codeZipSha256,
- CreateAgentVersionFromCodeContent content) {
- // Generated convenience method for createAgentVersionFromCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return createAgentVersionFromCodeWithResponse(agentName, codeZipSha256,
- new MultipartFormDataHelper(requestOptions).serializeJsonField("metadata", content.getMetadata())
- .serializeFileField("code", content.getCode().getContent(), content.getCode().getContentType(),
- content.getCode().getFilename())
- .end()
- .getRequestBody(),
- requestOptions).getValue().toObject(AgentVersionDetails.class);
- }
-
- /**
- * Download agent code
- *
- * Downloads the code zip for a code-based hosted agent.
- * Returns the previously-uploaded zip (`application/zip`).
- *
- * If `agent_version` is supplied, returns that version's code zip; otherwise
- * returns the latest version's code zip.
- *
- * The SHA-256 digest of the returned bytes matches the `content_hash` on the
- * resolved version's `code_configuration`.
- *
- * @param agentName The name of the agent.
- * @param agentVersion The version of the agent whose code zip should be downloaded.
- * If omitted, the latest version's code zip is returned.
- * @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 the response.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public BinaryData downloadAgentCode(String agentName, String agentVersion) {
- // Generated convenience method for downloadAgentCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (agentVersion != null) {
- requestOptions.addQueryParam("agent_version", agentVersion, false);
- }
- return downloadAgentCodeWithResponse(agentName, requestOptions).getValue();
- }
-
- /**
- * Download agent code
- *
- * Downloads the code zip for a code-based hosted agent.
- * Returns the previously-uploaded zip (`application/zip`).
- *
- * If `agent_version` is supplied, returns that version's code zip; otherwise
- * returns the latest version's code zip.
- *
- * The SHA-256 digest of the returned bytes matches the `content_hash` on the
- * resolved version's `code_configuration`.
- *
- * @param agentName The name of the agent.
- * @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 the response.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public BinaryData downloadAgentCode(String agentName) {
- // Generated convenience method for downloadAgentCodeWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return downloadAgentCodeWithResponse(agentName, requestOptions).getValue();
- }
-
- /**
- * Create a session
- *
- * Creates a new session for an agent endpoint.
- * The endpoint resolves the backing agent version from `version_indicator` and
- * enforces session ownership using the provided isolation key for session-mutating operations.
- *
- * @param agentName The name of the agent to create a session for.
- * @param versionIndicator Determines which agent version backs the session.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @param agentSessionId Optional caller-provided session ID. If specified, it must be unique within the agent
- * endpoint. Auto-generated if omitted.
- * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AgentSessionResource createSession(String agentName, VersionIndicator versionIndicator,
- String userIsolationKey, String agentSessionId) {
- // Generated convenience method for createSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- CreateSessionRequest createSessionRequestObj
- = new CreateSessionRequest(versionIndicator).setAgentSessionId(agentSessionId);
- BinaryData createSessionRequest = BinaryData.fromObject(createSessionRequestObj);
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return createSessionWithResponse(agentName, createSessionRequest, requestOptions).getValue()
- .toObject(AgentSessionResource.class);
- }
-
- /**
- * Create a session
- *
- * Creates a new session for an agent endpoint.
- * The endpoint resolves the backing agent version from `version_indicator` and
- * enforces session ownership using the provided isolation key for session-mutating operations.
- *
- * @param agentName The name of the agent to create a session for.
- * @param versionIndicator Determines which agent version backs the session.
- * @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 an agent session providing a long-lived compute sandbox for hosted agent invocations.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AgentSessionResource createSession(String agentName, VersionIndicator versionIndicator) {
- // Generated convenience method for createSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- CreateSessionRequest createSessionRequestObj = new CreateSessionRequest(versionIndicator);
- BinaryData createSessionRequest = BinaryData.fromObject(createSessionRequestObj);
- return createSessionWithResponse(agentName, createSessionRequest, requestOptions).getValue()
- .toObject(AgentSessionResource.class);
- }
-
- /**
- * Get a session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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 session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AgentSessionResource getSession(String agentName, String sessionId, String userIsolationKey) {
- // Generated convenience method for getSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return getSessionWithResponse(agentName, sessionId, requestOptions).getValue()
- .toObject(AgentSessionResource.class);
- }
-
- /**
- * Get a session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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 session
- *
- * Retrieves the details of a hosted agent session by agent name and session identifier.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AgentSessionResource getSession(String agentName, String sessionId) {
- // Generated convenience method for getSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return getSessionWithResponse(agentName, sessionId, requestOptions).getValue()
- .toObject(AgentSessionResource.class);
- }
-
- /**
- * Delete a session
- *
- * Deletes a session synchronously.
- * Returns 204 No Content when the session is deleted or does not exist.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void deleteSession(String agentName, String sessionId, String userIsolationKey) {
- // Generated convenience method for deleteSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- deleteSessionWithResponse(agentName, sessionId, requestOptions).getValue();
- }
-
- /**
- * Delete a session
- *
- * Deletes a session synchronously.
- * Returns 204 No Content when the session is deleted or does not exist.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void deleteSession(String agentName, String sessionId) {
- // Generated convenience method for deleteSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- deleteSessionWithResponse(agentName, sessionId, requestOptions).getValue();
- }
-
- /**
- * Stop a session
- *
- * Terminates the specified hosted agent session and returns 204 No Content when the request succeeds.
- *
- * @param agentName The name of the agent.
- * @param sessionId The session identifier.
- * @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.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void stopSession(String agentName, String sessionId) {
- // Generated convenience method for stopSessionWithResponse
- RequestOptions requestOptions = new RequestOptions();
- stopSessionWithResponse(agentName, sessionId, requestOptions).getValue();
- }
-
- /**
- * List sessions for an agent
- *
- * Returns a paged collection of sessions associated with the specified agent endpoint.
- *
- * @param agentName The name of the agent.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
- * default is 20.
- * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
- * for descending order.
- * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list.
- * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
- * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listSessions(String agentName, String userIsolationKey, Integer limit,
- PageOrder order, String after, String before) {
- // Generated convenience method for listSessions
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- if (limit != null) {
- requestOptions.addQueryParam("limit", String.valueOf(limit), false);
- }
- if (order != null) {
- requestOptions.addQueryParam("order", order.toString(), false);
- }
- if (after != null) {
- requestOptions.addQueryParam("after", after, false);
- }
- if (before != null) {
- requestOptions.addQueryParam("before", before, false);
- }
- return serviceClient.listSessions(agentName, requestOptions)
- .mapPage(bodyItemValue -> bodyItemValue.toObject(AgentSessionResource.class));
- }
-
- /**
- * List sessions for an agent
- *
- * Returns a paged collection of sessions associated with the specified agent endpoint.
- *
- * @param agentName The name of the agent.
- * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listSessions(String agentName) {
- // Generated convenience method for listSessions
- RequestOptions requestOptions = new RequestOptions();
- return serviceClient.listSessions(agentName, requestOptions)
- .mapPage(bodyItemValue -> bodyItemValue.toObject(AgentSessionResource.class));
- }
-
- /**
- * Upload a session file
- *
- * Uploads binary file content to the specified path in the session sandbox.
- * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The destination file path within the sandbox, relative to the session home directory.
- * @param content The content parameter.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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 response from uploading a file to a session sandbox.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public SessionFileWriteResult uploadSessionFile(String agentName, String agentSessionId, String path,
- BinaryData content, String userIsolationKey) {
- // Generated convenience method for uploadSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return uploadSessionFileWithResponse(agentName, agentSessionId, path, content, requestOptions).getValue()
- .toObject(SessionFileWriteResult.class);
- }
-
- /**
- * Upload a session file
- *
- * Uploads binary file content to the specified path in the session sandbox.
- * The service stores the file relative to the session home directory and rejects payloads larger than 50 MB.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The destination file path within the sandbox, relative to the session home directory.
- * @param content The content parameter.
- * @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 response from uploading a file to a session sandbox.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public SessionFileWriteResult uploadSessionFile(String agentName, String agentSessionId, String path,
- BinaryData content) {
- // Generated convenience method for uploadSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return uploadSessionFileWithResponse(agentName, agentSessionId, path, content, requestOptions).getValue()
- .toObject(SessionFileWriteResult.class);
- }
-
- /**
- * Download a session file
- *
- * Downloads the file at the specified sandbox path as a binary stream.
- * The path is resolved relative to the session home directory.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file path to download from the sandbox, relative to the session home directory.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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 the response.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public BinaryData downloadSessionFile(String agentName, String agentSessionId, String path,
- String userIsolationKey) {
- // Generated convenience method for downloadSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- return downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).getValue();
- }
-
- /**
- * Download a session file
- *
- * Downloads the file at the specified sandbox path as a binary stream.
- * The path is resolved relative to the session home directory.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file path to download from the sandbox, relative to the session home directory.
- * @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 the response.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public BinaryData downloadSessionFile(String agentName, String agentSessionId, String path) {
- // Generated convenience method for downloadSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return downloadSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).getValue();
- }
-
- /**
- * List session files
- *
- * Returns files and directories at the specified path in the session sandbox.
- * The response includes only the immediate children of the target directory and defaults to the session home
- * directory when no path is supplied.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The directory path to list, relative to the session home directory. Defaults to the home directory if
- * not provided.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
- * default is 20.
- * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
- * for descending order.
- * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list.
- * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
- * @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 the paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listSessionFiles(String agentName, String agentSessionId, String path,
- String userIsolationKey, Integer limit, PageOrder order, String after, String before) {
- // Generated convenience method for listSessionFiles
- RequestOptions requestOptions = new RequestOptions();
- if (path != null) {
- requestOptions.addQueryParam("path", path, false);
- }
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- if (limit != null) {
- requestOptions.addQueryParam("limit", String.valueOf(limit), false);
- }
- if (order != null) {
- requestOptions.addQueryParam("order", order.toString(), false);
- }
- if (after != null) {
- requestOptions.addQueryParam("after", after, false);
- }
- if (before != null) {
- requestOptions.addQueryParam("before", before, false);
- }
- return serviceClient.listSessionFiles(agentName, agentSessionId, requestOptions)
- .mapPage(bodyItemValue -> bodyItemValue.toObject(SessionDirectoryEntry.class));
- }
-
- /**
- * List session files
- *
- * Returns files and directories at the specified path in the session sandbox.
- * The response includes only the immediate children of the target directory and defaults to the session home
- * directory when no path is supplied.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @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 the paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listSessionFiles(String agentName, String agentSessionId) {
- // Generated convenience method for listSessionFiles
- RequestOptions requestOptions = new RequestOptions();
- return serviceClient.listSessionFiles(agentName, agentSessionId, requestOptions)
- .mapPage(bodyItemValue -> bodyItemValue.toObject(SessionDirectoryEntry.class));
- }
-
- /**
- * Delete a session file
- *
- * Deletes the specified file or directory from the session sandbox.
- * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
- *
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file or directory path to delete, relative to the session home directory.
- * @param recursive Whether to recursively delete directory contents. The service defaults to `false` if a value is
- * not specified by the caller.
- * @param userIsolationKey Opaque per-user isolation key used to scope endpoint-scoped data (responses,
- * conversations, sessions) to a specific end user.
- * @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.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void deleteSessionFile(String agentName, String agentSessionId, String path, Boolean recursive,
- String userIsolationKey) {
- // Generated convenience method for deleteSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (recursive != null) {
- requestOptions.addQueryParam("recursive", String.valueOf(recursive), false);
- }
- if (userIsolationKey != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("x-ms-user-isolation-key"), userIsolationKey);
- }
- deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).getValue();
- }
-
- /**
- * Delete a session file
- *
- * Deletes the specified file or directory from the session sandbox.
- * When `recursive` is false, deleting a non-empty directory returns 409 Conflict.
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
+ * }
+ * agent (Optional): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * }
+ * }
+ *
*
- * @param agentName The name of the agent.
- * @param agentSessionId The session ID.
- * @param path The file or directory path to delete, relative to the session home directory.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @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.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the response data for a requested list of items as paginated response with {@link PagedIterable}.
*/
@Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void deleteSessionFile(String agentName, String agentSessionId, String path) {
- // Generated convenience method for deleteSessionFileWithResponse
- RequestOptions requestOptions = new RequestOptions();
- deleteSessionFileWithResponse(agentName, agentSessionId, path, requestOptions).getValue();
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listOptimizationJobs(RequestOptions requestOptions) {
+ return this.serviceClient.listOptimizationJobs(requestOptions);
}
/**
- * Create an agent optimization job
+ * Cancels an agent optimization job.
*
- * Creates an agent optimization job and returns the queued job.
- * Honors `Operation-Id` for idempotent retry.
+ * Request cancellation of a running or queued job. Returns an error if the job is already in a terminal state.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * inputs (Optional): {
+ * agent (Required): {
+ * agent_name: String (Required)
+ * agent_version: String (Optional)
+ * }
+ * train_dataset (Required): {
+ * type: String(inline/reference) (Required)
+ * }
+ * validation_dataset (Optional): (recursive schema, see validation_dataset above)
+ * evaluators (Required): [
+ * (Required){
+ * name: String (Required)
+ * version: String (Optional)
+ * }
+ * ]
+ * options (Optional): {
+ * max_candidates: Integer (Optional)
+ * optimization_config (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * eval_model: String (Optional)
+ * optimization_model: String (Optional)
+ * evaluation_level: String(turn/conversation) (Optional)
+ * }
+ * }
+ * result (Optional): {
+ * baseline: String (Optional)
+ * best: String (Optional)
+ * candidates (Optional): [
+ * (Optional){
+ * candidate_id: String (Optional)
+ * name: String (Required)
+ * mutations (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * avg_score: double (Required)
+ * avg_tokens: double (Required)
+ * eval_id: String (Optional)
+ * eval_run_id: String (Optional)
+ * promotion (Optional): {
+ * promoted_at: long (Required)
+ * agent_name: String (Required)
+ * agent_version: String (Required)
+ * }
+ * }
+ * ]
+ * }
+ * status: String(queued/in_progress/succeeded/failed/cancelled) (Required)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * param: String (Optional)
+ * type: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * additionalInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * debugInfo (Optional): {
+ * String: BinaryData (Required)
+ * }
+ * }
+ * created_at: long (Required)
+ * updated_at: long (Required)
+ * progress (Optional): {
+ * candidates_completed: int (Required)
+ * best_score: double (Required)
+ * elapsed_seconds: double (Required)
+ * }
+ * warnings (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * }
+ *
*
- * @param inputs The optimization job inputs.
- * @param operationId Client-generated unique ID for idempotent retries. When absent, the server creates the job
- * unconditionally.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @param jobId The ID of the job to cancel.
+ * @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.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores.
+ * (instructions, model, skills, tools) to maximize evaluation scores along with {@link Response}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public OptimizationJob createOptimizationJob(OptimizationJobInputs inputs, String operationId) {
- // Generated convenience method for createOptimizationJobWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (operationId != null) {
- requestOptions.setHeader(HttpHeaderName.fromString("Operation-Id"), operationId);
- }
- return createOptimizationJobWithResponse(BinaryData.fromObject(inputs), requestOptions).getValue()
- .toObject(OptimizationJob.class);
+ public Response cancelOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
+ return this.serviceClient.cancelOptimizationJobWithResponse(jobId, requestOptions);
}
/**
- * Create an agent optimization job
+ * Deletes an agent optimization job.
*
- * Creates an agent optimization job and returns the queued job.
- * Honors `Operation-Id` for idempotent retry.
+ * Delete the job and its candidate artifacts. Cancels first if non-terminal.
*
- * @param inputs The optimization job inputs.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @param jobId The ID of the job 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.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return agent optimization job resource — a long-running job that optimizes an agent's configuration
- * (instructions, model, skills, tools) to maximize evaluation scores.
+ * @return the {@link Response}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public OptimizationJob createOptimizationJob(OptimizationJobInputs inputs) {
- // Generated convenience method for createOptimizationJobWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return createOptimizationJobWithResponse(BinaryData.fromObject(inputs), requestOptions).getValue()
- .toObject(OptimizationJob.class);
+ public Response deleteOptimizationJobWithResponse(String jobId, RequestOptions requestOptions) {
+ return this.serviceClient.deleteOptimizationJobWithResponse(jobId, requestOptions);
}
/**
- * Get an agent optimization job
+ * Get info about an agent optimization job.
*
- * Retrieves the specified agent optimization job.
- * Returns 202 while the job is in progress and 200 after it reaches a terminal state.
+ * Get an optimization job by id.
*
* @param jobId The ID of the job.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -2818,10 +549,9 @@ public OptimizationJob createOptimizationJob(OptimizationJobInputs inputs) {
* @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 an agent optimization job
+ * @return info about an agent optimization job.
*
- * Retrieves the specified agent optimization job.
- * Returns 202 while the job is in progress and 200 after it reaches a terminal state.
+ * Get an optimization job by id.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -2832,9 +562,9 @@ public OptimizationJob getOptimizationJob(String jobId) {
}
/**
- * List agent optimization jobs
+ * Returns a list of agent optimization jobs.
*
- * Returns agent optimization jobs with cursor pagination and optional lifecycle or agent filters.
+ * List optimization jobs. Supports cursor pagination and optional status / agent_name filters.
*
* @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
* default is 20.
@@ -2858,7 +588,7 @@ public OptimizationJob getOptimizationJob(String jobId) {
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listOptimizationJobs(Integer limit, PageOrder order, String after,
+ public PagedIterable listOptimizationJobs(Integer limit, PageOrder order, String after,
String before, JobStatus status, String agentName) {
// Generated convenience method for listOptimizationJobs
RequestOptions requestOptions = new RequestOptions();
@@ -2881,13 +611,13 @@ public PagedIterable listOptimizationJobs(Integer limit, PageOr
requestOptions.addQueryParam("agent_name", agentName, false);
}
return serviceClient.listOptimizationJobs(requestOptions)
- .mapPage(bodyItemValue -> bodyItemValue.toObject(OptimizationJob.class));
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(OptimizationJobListItem.class));
}
/**
- * List agent optimization jobs
+ * Returns a list of agent optimization jobs.
*
- * Returns agent optimization jobs with cursor pagination and optional lifecycle or agent filters.
+ * List optimization jobs. Supports cursor pagination and optional status / agent_name filters.
*
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -2898,18 +628,17 @@ public PagedIterable listOptimizationJobs(Integer limit, PageOr
*/
@Generated
@ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listOptimizationJobs() {
+ public PagedIterable listOptimizationJobs() {
// Generated convenience method for listOptimizationJobs
RequestOptions requestOptions = new RequestOptions();
return serviceClient.listOptimizationJobs(requestOptions)
- .mapPage(bodyItemValue -> bodyItemValue.toObject(OptimizationJob.class));
+ .mapPage(bodyItemValue -> bodyItemValue.toObject(OptimizationJobListItem.class));
}
/**
- * Cancel an agent optimization job
+ * Cancels an agent optimization job.
*
- * Requests cancellation of the specified agent optimization job.
- * The operation remains idempotent after the job reaches a terminal state.
+ * Request cancellation of a running or queued job. Returns an error if the job is already in a terminal state.
*
* @param jobId The ID of the job to cancel.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -2930,36 +659,9 @@ public OptimizationJob cancelOptimizationJob(String jobId) {
}
/**
- * Delete an agent optimization job
- *
- * Deletes the specified agent optimization job and its candidate artifacts.
- * Cancels the job first when it is still in a non-terminal state.
- *
- * @param jobId The ID of the job to delete.
- * @param force When true, force-delete even if the job is in a non-terminal state.
- * @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.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void deleteOptimizationJob(String jobId, Boolean force) {
- // Generated convenience method for deleteOptimizationJobWithResponse
- RequestOptions requestOptions = new RequestOptions();
- if (force != null) {
- requestOptions.addQueryParam("force", String.valueOf(force), false);
- }
- deleteOptimizationJobWithResponse(jobId, requestOptions).getValue();
- }
-
- /**
- * Delete an agent optimization job
+ * Deletes an agent optimization job.
*
- * Deletes the specified agent optimization job and its candidate artifacts.
- * Cancels the job first when it is still in a non-terminal state.
+ * Delete the job and its candidate artifacts. Cancels first if non-terminal.
*
* @param jobId The ID of the job to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -2978,237 +680,55 @@ public void deleteOptimizationJob(String jobId) {
}
/**
- * List optimization job candidates
- *
- * Returns the candidates produced by the specified optimization job.
- *
- * @param jobId The optimization job id.
- * @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
- * default is 20.
- * @param order Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
- * for descending order.
- * @param after A cursor for use in pagination. `after` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list.
- * @param before A cursor for use in pagination. `before` is an object ID that defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list.
- * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listOptimizationCandidates(String jobId, Integer limit, PageOrder order,
- String after, String before) {
- // Generated convenience method for listOptimizationCandidates
- RequestOptions requestOptions = new RequestOptions();
- if (limit != null) {
- requestOptions.addQueryParam("limit", String.valueOf(limit), false);
- }
- if (order != null) {
- requestOptions.addQueryParam("order", order.toString(), false);
- }
- if (after != null) {
- requestOptions.addQueryParam("after", after, false);
- }
- if (before != null) {
- requestOptions.addQueryParam("before", before, false);
- }
- return serviceClient.listOptimizationCandidates(jobId, requestOptions)
- .mapPage(bodyItemValue -> bodyItemValue.toObject(OptimizationCandidate.class));
- }
-
- /**
- * List optimization job candidates
- *
- * Returns the candidates produced by the specified optimization job.
- *
- * @param jobId The optimization job id.
- * @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 the response data for a requested list of items as paginated response with {@link PagedIterable}.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listOptimizationCandidates(String jobId) {
- // Generated convenience method for listOptimizationCandidates
- RequestOptions requestOptions = new RequestOptions();
- return serviceClient.listOptimizationCandidates(jobId, requestOptions)
- .mapPage(bodyItemValue -> bodyItemValue.toObject(OptimizationCandidate.class));
- }
-
- /**
- * Get an optimization candidate
- *
- * Retrieves metadata, manifest information, and promotion details for the specified candidate.
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 an optimization candidate
- *
- * Retrieves metadata, manifest information, and promotion details for the specified candidate.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public CandidateMetadata getOptimizationCandidate(String jobId, String candidateId) {
- // Generated convenience method for getOptimizationCandidateWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return getOptimizationCandidateWithResponse(jobId, candidateId, requestOptions).getValue()
- .toObject(CandidateMetadata.class);
- }
-
- /**
- * Get an optimization candidate config
- *
- * Retrieves the deploy configuration JSON for the specified candidate.
- * Clients can use it to compose `agents.create_version(...)` requests.
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 an optimization candidate config
- *
- * Retrieves the deploy configuration JSON for the specified candidate.
- * Clients can use it to compose `agents.create_version(...)` requests.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public CandidateDeployConfig getOptimizationCandidateConfig(String jobId, String candidateId) {
- // Generated convenience method for getOptimizationCandidateConfigWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return getOptimizationCandidateConfigWithResponse(jobId, candidateId, requestOptions).getValue()
- .toObject(CandidateDeployConfig.class);
- }
-
- /**
- * Get optimization candidate results
- *
- * Retrieves full per-task evaluation results for the specified candidate.
- *
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @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 optimization candidate results
- *
- * Retrieves full per-task evaluation results for the specified candidate.
- */
- @Generated
- @ServiceMethod(returns = ReturnType.SINGLE)
- public CandidateResults getOptimizationCandidateResults(String jobId, String candidateId) {
- // Generated convenience method for getOptimizationCandidateResultsWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return getOptimizationCandidateResultsWithResponse(jobId, candidateId, requestOptions).getValue()
- .toObject(CandidateResults.class);
- }
-
- /**
- * Get an optimization candidate file
+ * Creates an agent optimization job.
*
- * Streams the specified file from the candidate's blob directory.
+ * Create an optimization job. Returns 201 with the queued job. Honours `Operation-Id` for idempotent retry.
*
- * @param jobId The optimization job id.
- * @param candidateId The candidate id.
- * @param path Relative path of the file to download (e.g. 'files/examples.jsonl').
+ * @param job The job to create.
+ * @param operationId Client-generated unique ID for idempotent retries. When absent, the server creates the job
+ * unconditionally.
* @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 an optimization candidate file
- *
- * Streams the specified file from the candidate's blob directory.
+ * @return agent optimization job resource — a long-running job that optimizes an agent's configuration
+ * (instructions, model, skills, tools) to maximize evaluation scores.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public BinaryData getOptimizationCandidateFile(String jobId, String candidateId, String path) {
- // Generated convenience method for getOptimizationCandidateFileWithResponse
+ public OptimizationJob createOptimizationJob(OptimizationJob job, String operationId) {
+ // Generated convenience method for createOptimizationJobWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getOptimizationCandidateFileWithResponse(jobId, candidateId, path, requestOptions).getValue();
+ if (operationId != null) {
+ requestOptions.setHeader(HttpHeaderName.fromString("Operation-Id"), operationId);
+ }
+ return createOptimizationJobWithResponse(BinaryData.fromObject(job), requestOptions).getValue()
+ .toObject(OptimizationJob.class);
}
/**
- * Promote an optimization candidate
+ * Creates an agent optimization job.
*
- * Promotes the specified candidate and records the deployment timestamp and target agent version.
+ * Create an optimization job. Returns 201 with the queued job. Honours `Operation-Id` for idempotent retry.
*
- * @param jobId The optimization job id.
- * @param candidateId The candidate id to promote.
- * @param candidateRequest Promotion details.
+ * @param job The job to create.
* @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 response after successfully promoting a candidate.
+ * @return agent optimization job resource — a long-running job that optimizes an agent's configuration
+ * (instructions, model, skills, tools) to maximize evaluation scores.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public PromoteCandidateResult promoteOptimizationCandidate(String jobId, String candidateId,
- PromoteCandidateInput candidateRequest) {
- // Generated convenience method for promoteOptimizationCandidateWithResponse
- RequestOptions requestOptions = new RequestOptions();
- return promoteOptimizationCandidateWithResponse(jobId, candidateId, BinaryData.fromObject(candidateRequest),
- requestOptions).getValue().toObject(PromoteCandidateResult.class);
- }
-
- /**
- * Streams console logs (stdout / stderr) for a specific hosted agent session as typed
- * {@link SessionLogEvent} values.
- *
- * @param agentName The name of the hosted agent.
- * @param agentVersion The version of the agent.
- * @param sessionId The session ID (maps to an ADC sandbox).
- * @return A stream of {@link SessionLogEvent} values emitted by the hosted agent session log stream.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public IterableStream getSessionLogStream(String agentName, String agentVersion,
- String sessionId) {
+ public OptimizationJob createOptimizationJob(OptimizationJob job) {
+ // Generated convenience method for createOptimizationJobWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getSessionLogStream(agentName, agentVersion, sessionId, requestOptions);
- }
-
- /**
- * Streams console logs (stdout / stderr) for a specific hosted agent session as typed
- * {@link SessionLogEvent} values.
- *
- * @param agentName The name of the hosted agent.
- * @param agentVersion The version of the agent.
- * @param sessionId The session ID (maps to an ADC sandbox).
- * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
- * @return A stream of {@link SessionLogEvent} values emitted by the hosted agent session log stream.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public IterableStream getSessionLogStream(String agentName, String agentVersion, String sessionId,
- RequestOptions requestOptions) {
- return new IterableStream<>(SessionLogStreamHelper
- .parse(getSessionLogStreamWithResponse(agentName, agentVersion, sessionId, requestOptions).getValue()
- .toFluxByteBuffer()));
+ return createOptimizationJobWithResponse(BinaryData.fromObject(job), requestOptions).getValue()
+ .toObject(OptimizationJob.class);
}
}
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaToolboxesAsyncClient.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ToolboxesAsyncClient.java
similarity index 97%
rename from sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaToolboxesAsyncClient.java
rename to sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ToolboxesAsyncClient.java
index 2b48791699b6..7087a01348fd 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaToolboxesAsyncClient.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ToolboxesAsyncClient.java
@@ -3,10 +3,9 @@
// Code generated by Microsoft (R) TypeSpec Code Generator.
package com.azure.ai.agents;
-import com.azure.ai.agents.implementation.BetaToolboxesImpl;
+import com.azure.ai.agents.implementation.ToolboxesImpl;
import com.azure.ai.agents.implementation.models.CreateToolboxVersionRequest;
import com.azure.ai.agents.implementation.models.UpdateToolboxRequest;
-import com.azure.ai.agents.implementation.utils.Beta;
import com.azure.ai.agents.models.PageOrder;
import com.azure.ai.agents.models.Tool;
import com.azure.ai.agents.models.ToolboxDetails;
@@ -38,19 +37,18 @@
* Initializes a new instance of the asynchronous AgentsClient type.
*/
@ServiceClient(builder = AgentsClientBuilder.class, isAsync = true)
-@Beta(warningText = "This class is in preview and may change in future releases.")
-public final class BetaToolboxesAsyncClient {
+public final class ToolboxesAsyncClient {
@Generated
- private final BetaToolboxesImpl serviceClient;
+ private final ToolboxesImpl serviceClient;
/**
- * Initializes an instance of BetaToolboxesAsyncClient class.
+ * Initializes an instance of ToolboxesAsyncClient class.
*
* @param serviceClient the service client implementation.
*/
@Generated
- BetaToolboxesAsyncClient(BetaToolboxesImpl serviceClient) {
+ ToolboxesAsyncClient(ToolboxesImpl serviceClient) {
this.serviceClient = serviceClient;
}
@@ -69,7 +67,7 @@ public final class BetaToolboxesAsyncClient {
* }
* tools (Required): [
* (Required){
- * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
+ * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/reminder_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
* }
* ]
* skills (Optional): [
@@ -101,7 +99,7 @@ public final class BetaToolboxesAsyncClient {
* created_at: long (Required)
* tools (Required): [
* (Required){
- * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
+ * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/reminder_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
* }
* ]
* skills (Optional): [
@@ -254,7 +252,7 @@ public PagedFlux listToolboxes(RequestOptions requestOptions) {
* created_at: long (Required)
* tools (Required): [
* (Required){
- * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
+ * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/reminder_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
* }
* ]
* skills (Optional): [
@@ -304,7 +302,7 @@ public PagedFlux listToolboxVersions(String name, RequestOptions req
* created_at: long (Required)
* tools (Required): [
* (Required){
- * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
+ * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/reminder_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
* }
* ]
* skills (Optional): [
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaToolboxesClient.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ToolboxesClient.java
similarity index 97%
rename from sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaToolboxesClient.java
rename to sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ToolboxesClient.java
index a37b9ad14b88..ad297c7721f5 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/BetaToolboxesClient.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ToolboxesClient.java
@@ -3,10 +3,9 @@
// Code generated by Microsoft (R) TypeSpec Code Generator.
package com.azure.ai.agents;
-import com.azure.ai.agents.implementation.BetaToolboxesImpl;
+import com.azure.ai.agents.implementation.ToolboxesImpl;
import com.azure.ai.agents.implementation.models.CreateToolboxVersionRequest;
import com.azure.ai.agents.implementation.models.UpdateToolboxRequest;
-import com.azure.ai.agents.implementation.utils.Beta;
import com.azure.ai.agents.models.PageOrder;
import com.azure.ai.agents.models.Tool;
import com.azure.ai.agents.models.ToolboxDetails;
@@ -32,19 +31,18 @@
* Initializes a new instance of the synchronous AgentsClient type.
*/
@ServiceClient(builder = AgentsClientBuilder.class)
-@Beta(warningText = "This class is in preview and may change in future releases.")
-public final class BetaToolboxesClient {
+public final class ToolboxesClient {
@Generated
- private final BetaToolboxesImpl serviceClient;
+ private final ToolboxesImpl serviceClient;
/**
- * Initializes an instance of BetaToolboxesClient class.
+ * Initializes an instance of ToolboxesClient class.
*
* @param serviceClient the service client implementation.
*/
@Generated
- BetaToolboxesClient(BetaToolboxesImpl serviceClient) {
+ ToolboxesClient(ToolboxesImpl serviceClient) {
this.serviceClient = serviceClient;
}
@@ -63,7 +61,7 @@ public final class BetaToolboxesClient {
* }
* tools (Required): [
* (Required){
- * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
+ * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/reminder_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
* }
* ]
* skills (Optional): [
@@ -95,7 +93,7 @@ public final class BetaToolboxesClient {
* created_at: long (Required)
* tools (Required): [
* (Required){
- * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
+ * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/reminder_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
* }
* ]
* skills (Optional): [
@@ -246,7 +244,7 @@ public PagedIterable listToolboxes(RequestOptions requestOptions) {
* created_at: long (Required)
* tools (Required): [
* (Required){
- * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
+ * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/reminder_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
* }
* ]
* skills (Optional): [
@@ -296,7 +294,7 @@ public PagedIterable listToolboxVersions(String name, RequestOptions
* created_at: long (Required)
* tools (Required): [
* (Required){
- * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
+ * type: String(function/file_search/computer/computer_use_preview/web_search/mcp/code_interpreter/image_generation/local_shell/shell/custom/namespace/tool_search/web_search_preview/apply_patch/a2a_preview/bing_custom_search_preview/browser_automation_preview/fabric_dataagent_preview/sharepoint_grounding_preview/memory_search_preview/work_iq_preview/fabric_iq_preview/toolbox_search_preview/reminder_preview/azure_ai_search/azure_function/bing_grounding/capture_structured_outputs/openapi) (Required)
* }
* ]
* skills (Optional): [
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsClientImpl.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsClientImpl.java
index cf6389f143fc..d5d107362708 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsClientImpl.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsClientImpl.java
@@ -94,20 +94,6 @@ public BetaMemoryStoresImpl getBetaMemoryStores() {
return this.betaMemoryStores;
}
- /**
- * The BetaToolboxesImpl object to access its operations.
- */
- private final BetaToolboxesImpl betaToolboxes;
-
- /**
- * Gets the BetaToolboxesImpl object to access its operations.
- *
- * @return the BetaToolboxesImpl object.
- */
- public BetaToolboxesImpl getBetaToolboxes() {
- return this.betaToolboxes;
- }
-
/**
* The BetaAgentsImpl object to access its operations.
*/
@@ -136,6 +122,20 @@ public AgentsImpl getAgents() {
return this.agents;
}
+ /**
+ * The ToolboxesImpl object to access its operations.
+ */
+ private final ToolboxesImpl toolboxes;
+
+ /**
+ * Gets the ToolboxesImpl object to access its operations.
+ *
+ * @return the ToolboxesImpl object.
+ */
+ public ToolboxesImpl getToolboxes() {
+ return this.toolboxes;
+ }
+
/**
* Initializes an instance of AgentsClient client.
*
@@ -185,8 +185,8 @@ public AgentsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerA
this.endpoint = endpoint;
this.serviceVersion = serviceVersion;
this.betaMemoryStores = new BetaMemoryStoresImpl(this);
- this.betaToolboxes = new BetaToolboxesImpl(this);
this.betaAgents = new BetaAgentsImpl(this);
this.agents = new AgentsImpl(this);
+ this.toolboxes = new ToolboxesImpl(this);
}
}
diff --git a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsImpl.java b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsImpl.java
index df20978d9abb..788d75a0801a 100644
--- a/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsImpl.java
+++ b/sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/AgentsImpl.java
@@ -12,8 +12,10 @@
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
+import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
@@ -120,6 +122,32 @@ Response createAgentSync(@HostParam("endpoint") String endpoint,
@HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createAgentRequest,
RequestOptions requestOptions, Context context);
+ // @Multipart not supported by RestProxy
+ @Post("/agents")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createAgentFromCode(@HostParam("endpoint") String endpoint,
+ @HeaderParam("content-type") String contentType, @HeaderParam("x-ms-agent-name") String agentName,
+ @HeaderParam("x-ms-code-zip-sha256") String codeZipSha256, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData content,
+ RequestOptions requestOptions, Context context);
+
+ // @Multipart not supported by RestProxy
+ @Post("/agents")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createAgentFromCodeSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("content-type") String contentType, @HeaderParam("x-ms-agent-name") String agentName,
+ @HeaderParam("x-ms-code-zip-sha256") String codeZipSha256, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData content,
+ RequestOptions requestOptions, Context context);
+
@Post("/agents/{agent_name}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
@@ -144,6 +172,32 @@ Response updateAgentSync(@HostParam("endpoint") String endpoint,
@BodyParam("application/json") BinaryData updateAgentRequest, RequestOptions requestOptions,
Context context);
+ // @Multipart not supported by RestProxy
+ @Post("/agents/{agent_name}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> updateAgentFromCode(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @HeaderParam("content-type") String contentType,
+ @HeaderParam("x-ms-code-zip-sha256") String codeZipSha256, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData content,
+ RequestOptions requestOptions, Context context);
+
+ // @Multipart not supported by RestProxy
+ @Post("/agents/{agent_name}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response updateAgentFromCodeSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @HeaderParam("content-type") String contentType,
+ @HeaderParam("x-ms-code-zip-sha256") String codeZipSha256, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData content,
+ RequestOptions requestOptions, Context context);
+
@Post("/agents:import")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
@@ -344,6 +398,334 @@ Response listAgentVersionsSync(@HostParam("endpoint") String endpoin
@PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ @Patch("/agents/{agent_name}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> updateAgentDetails(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @HeaderParam("Content-Type") String contentType,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+ @BodyParam("application/merge-patch+json") BinaryData patchAgentObjectRequest,
+ RequestOptions requestOptions, Context context);
+
+ @Patch("/agents/{agent_name}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response updateAgentDetailsSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @HeaderParam("Content-Type") String contentType,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+ @BodyParam("application/merge-patch+json") BinaryData patchAgentObjectRequest,
+ RequestOptions requestOptions, Context context);
+
+ // @Multipart not supported by RestProxy
+ @Post("/agents/{agent_name}/versions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createAgentVersionFromCode(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @HeaderParam("content-type") String contentType,
+ @HeaderParam("x-ms-code-zip-sha256") String codeZipSha256, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData content,
+ RequestOptions requestOptions, Context context);
+
+ // @Multipart not supported by RestProxy
+ @Post("/agents/{agent_name}/versions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createAgentVersionFromCodeSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @HeaderParam("content-type") String contentType,
+ @HeaderParam("x-ms-code-zip-sha256") String codeZipSha256, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, @BodyParam("multipart/form-data") BinaryData content,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/code:download")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> downloadAgentCode(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/code:download")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response downloadAgentCodeSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Post("/agents/{agent_name}:enable")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> enableAgent(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/agents/{agent_name}:enable")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response enableAgentSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/agents/{agent_name}:disable")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> disableAgent(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/agents/{agent_name}:disable")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response disableAgentSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/agents/{agent_name}/endpoint/sessions")
+ @ExpectedResponses({ 201 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> createSession(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+ @BodyParam("application/json") BinaryData createSessionRequest, RequestOptions requestOptions,
+ Context context);
+
+ @Post("/agents/{agent_name}/endpoint/sessions")
+ @ExpectedResponses({ 201 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response createSessionSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+ @BodyParam("application/json") BinaryData createSessionRequest, RequestOptions requestOptions,
+ Context context);
+
+ @Get("/agents/{agent_name}/endpoint/sessions/{session_id}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getSession(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("session_id") String sessionId,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/endpoint/sessions/{session_id}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getSessionSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("session_id") String sessionId,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Delete("/agents/{agent_name}/endpoint/sessions/{session_id}")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> deleteSession(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("session_id") String sessionId,
+ @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context);
+
+ @Delete("/agents/{agent_name}/endpoint/sessions/{session_id}")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response deleteSessionSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("session_id") String sessionId,
+ @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context);
+
+ @Post("/agents/{agent_name}/endpoint/sessions/{session_id}:stop")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> stopSession(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("session_id") String sessionId,
+ @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context);
+
+ @Post("/agents/{agent_name}/endpoint/sessions/{session_id}:stop")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response stopSessionSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("session_id") String sessionId,
+ @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/endpoint/sessions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listSessions(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/endpoint/sessions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listSessionsSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/versions/{agent_version}/sessions/{session_id}:logstream")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getSessionLogStream(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_version") String agentVersion,
+ @PathParam("session_id") String sessionId, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/versions/{agent_version}/sessions/{session_id}:logstream")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getSessionLogStreamSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_version") String agentVersion,
+ @PathParam("session_id") String sessionId, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Put("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content")
+ @ExpectedResponses({ 201 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> uploadSessionFile(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_session_id") String agentSessionId,
+ @QueryParam("path") String path, @HeaderParam("Content-Type") String contentType,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+ @BodyParam("application/octet-stream") BinaryData content, RequestOptions requestOptions, Context context);
+
+ @Put("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content")
+ @ExpectedResponses({ 201 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response uploadSessionFileSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_session_id") String agentSessionId,
+ @QueryParam("path") String path, @HeaderParam("Content-Type") String contentType,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+ @BodyParam("application/octet-stream") BinaryData content, RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> downloadSessionFile(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_session_id") String agentSessionId,
+ @QueryParam("path") String path, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response downloadSessionFileSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_session_id") String agentSessionId,
+ @QueryParam("path") String path, @QueryParam("api-version") String apiVersion,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> listSessionFiles(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_session_id") String agentSessionId,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response listSessionFilesSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_session_id") String agentSessionId,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions, Context context);
+
+ @Delete("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> deleteSessionFile(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_session_id") String agentSessionId,
+ @QueryParam("path") String path, @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions, Context context);
+
+ @Delete("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files")
+ @ExpectedResponses({ 204 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response deleteSessionFileSync(@HostParam("endpoint") String endpoint,
+ @PathParam("agent_name") String agentName, @PathParam("agent_session_id") String agentSessionId,
+ @QueryParam("path") String path, @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions, Context context);
+
@Get("/openai/v1/conversations")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
@@ -375,6 +757,7 @@ Response listAgentConversationsSync(@HostParam("endpoint") String en
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -476,6 +859,7 @@ public Mono> getAgentWithResponseAsync(String agentName, Re
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -574,6 +958,7 @@ public Response getAgentWithResponse(String agentName, RequestOption
* {@code
* {
* name: String (Required)
+ * state: String(enabled/disabled) (Optional)
* metadata (Optional): {
* String: String (Required)
* }
@@ -634,6 +1019,7 @@ public Response getAgentWithResponse(String agentName, RequestOption
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -733,6 +1119,7 @@ public Mono> createAgentWithResponseAsync(BinaryData create
* {@code
* {
* name: String (Required)
+ * state: String(enabled/disabled) (Optional)
* metadata (Optional): {
* String: String (Required)
* }
@@ -793,6 +1180,7 @@ public Mono> createAgentWithResponseAsync(BinaryData create
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -881,32 +1269,125 @@ public Response createAgentWithResponse(BinaryData createAgentReques
}
/**
- * Update an agent
+ * Create a new code-based agent
*
- * Updates the agent by adding a new version if there are any changes to the agent definition.
- * If no changes, returns the existing agent version.
- * Request Body Schema
+ * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
+ * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
+ * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
+ * Response Body Schema
*
*
* {@code
* {
- * metadata (Optional): {
- * String: String (Required)
- * }
- * description: String (Optional)
- * definition (Required): {
- * kind: String(prompt/hosted/workflow/external) (Required)
- * rai_config (Optional): {
- * rai_policy_name: String (Required)
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * state: String(enabled/disabled) (Required)
+ * versions (Required): {
+ * latest (Required): {
+ * metadata (Required): {
+ * String: String (Required)
+ * }
+ * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
+ * id: String (Required)
+ * name: String (Required)
+ * version: String (Required)
+ * description: String (Optional)
+ * created_at: long (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * status: String(creating/active/failed/deleting/deleted) (Optional)
+ * instance_identity (Optional): {
+ * principal_id: String (Required)
+ * client_id: String (Required)
+ * }
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * }
+ * agent_guid: String (Optional)
* }
* }
- * blueprint_reference (Optional): {
- * type: String(ManagedAgentIdentityBlueprint) (Required)
+ * agent_endpoint (Optional): {
+ * version_selector (Optional): {
+ * version_selection_rules (Optional, Required on create): [
+ * (Optional, Required on create){
+ * type: String(FixedRatio) (Required)
+ * agent_version: String (Optional, Required on create)
+ * }
+ * ]
+ * }
+ * protocols (Optional): [
+ * String(activity/responses/a2a/mcp/invocations/invocations_ws) (Optional)
+ * ]
+ * authorization_schemes (Optional): [
+ * (Optional){
+ * type: String(Entra/BotService/BotServiceRbac) (Required)
+ * }
+ * ]
+ * }
+ * instance_identity (Optional): (recursive schema, see instance_identity above)
+ * blueprint (Optional): (recursive schema, see blueprint above)
+ * blueprint_reference (Optional): (recursive schema, see blueprint_reference above)
+ * agent_card (Optional): {
+ * version: String (Optional, Required on create)
+ * description: String (Optional)
+ * skills (Optional, Required on create): [
+ * (Optional, Required on create){
+ * id: String (Optional, Required on create)
+ * name: String (Optional, Required on create)
+ * description: String (Optional)
+ * tags (Optional): [
+ * String (Optional)
+ * ]
+ * examples (Optional): [
+ * String (Optional)
+ * ]
+ * }
+ * ]
* }
* }
* }
*
*
+ * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
+ * hyphens allowed in the middle.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
+ * @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> createAgentFromCodeWithResponseAsync(String agentName, String codeZipSha256,
+ BinaryData content, RequestOptions requestOptions) {
+ final String contentType = "multipart/form-data";
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.createAgentFromCode(this.client.getEndpoint(), contentType, agentName,
+ codeZipSha256, this.client.getServiceVersion().getVersion(), accept, content, requestOptions, context));
+ }
+
+ /**
+ * Create a new code-based agent
+ *
+ * Creates a new code-based agent. Uploads the code zip and creates the agent in a single call.
+ * The agent name is provided in the `x-ms-agent-name` header since POST /agents has no name in the URL path.
+ * The SHA-256 hex digest of the zip is provided in the `x-ms-code-zip-sha256` header for integrity and dedup.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
* Response Body Schema
*
*
@@ -915,6 +1396,7 @@ public Response createAgentWithResponse(BinaryData createAgentReques
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -986,23 +1468,25 @@ public Response createAgentWithResponse(BinaryData createAgentReques
* }
*
*
- * @param agentName The name of the agent to retrieve.
- * @param updateAgentRequest The updateAgentRequest parameter.
+ * @param agentName The unique name that identifies the agent. Max 63 chars, must start and end with alphanumeric,
+ * hyphens allowed in the middle.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
* @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ * @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> updateAgentWithResponseAsync(String agentName, BinaryData updateAgentRequest,
- RequestOptions requestOptions) {
- final String contentType = "application/json";
+ public Response createAgentFromCodeWithResponse(String agentName, String codeZipSha256,
+ BinaryData content, RequestOptions requestOptions) {
+ final String contentType = "multipart/form-data";
final String accept = "application/json";
- return FluxUtil.withContext(context -> service.updateAgent(this.client.getEndpoint(), agentName,
- this.client.getServiceVersion().getVersion(), contentType, accept, updateAgentRequest, requestOptions,
- context));
+ return service.createAgentFromCodeSync(this.client.getEndpoint(), contentType, agentName, codeZipSha256,
+ this.client.getServiceVersion().getVersion(), accept, content, requestOptions, Context.NONE);
}
/**
@@ -1040,6 +1524,7 @@ public Mono> updateAgentWithResponseAsync(String agentName,
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1118,35 +1603,40 @@ public Mono> updateAgentWithResponseAsync(String agentName,
* @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 the response body along with {@link Response}.
+ * @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response updateAgentWithResponse(String agentName, BinaryData updateAgentRequest,
+ public Mono> updateAgentWithResponseAsync(String agentName, BinaryData updateAgentRequest,
RequestOptions requestOptions) {
final String contentType = "application/json";
final String accept = "application/json";
- return service.updateAgentSync(this.client.getEndpoint(), agentName,
+ return FluxUtil.withContext(context -> service.updateAgent(this.client.getEndpoint(), agentName,
this.client.getServiceVersion().getVersion(), contentType, accept, updateAgentRequest, requestOptions,
- Context.NONE);
+ context));
}
/**
- * Create an agent from a manifest
+ * Update an agent
*
- * Imports the provided manifest to create an agent and returns the created resource.
+ * Updates the agent by adding a new version if there are any changes to the agent definition.
+ * If no changes, returns the existing agent version.
* Request Body Schema
*
*
* {@code
* {
- * name: String (Required)
* metadata (Optional): {
* String: String (Required)
* }
* description: String (Optional)
- * manifest_id: String (Required)
- * parameter_values (Required): {
- * String: BinaryData (Required)
+ * definition (Required): {
+ * kind: String(prompt/hosted/workflow/external) (Required)
+ * rai_config (Optional): {
+ * rai_policy_name: String (Required)
+ * }
+ * }
+ * blueprint_reference (Optional): {
+ * type: String(ManagedAgentIdentityBlueprint) (Required)
* }
* }
* }
@@ -1160,6 +1650,7 @@ public Response updateAgentWithResponse(String agentName, BinaryData
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1231,46 +1722,33 @@ public Response updateAgentWithResponse(String agentName, BinaryData
* }
*
*
- * @param createAgentFromManifestRequest The createAgentFromManifestRequest parameter.
+ * @param agentName The name of the agent to retrieve.
+ * @param updateAgentRequest The updateAgentRequest parameter.
* @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ * @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> createAgentFromManifestWithResponseAsync(
- BinaryData createAgentFromManifestRequest, RequestOptions requestOptions) {
+ public Response updateAgentWithResponse(String agentName, BinaryData updateAgentRequest,
+ RequestOptions requestOptions) {
final String contentType = "application/json";
final String accept = "application/json";
- return FluxUtil.withContext(context -> service.createAgentFromManifest(this.client.getEndpoint(),
- this.client.getServiceVersion().getVersion(), contentType, accept, createAgentFromManifestRequest,
- requestOptions, context));
+ return service.updateAgentSync(this.client.getEndpoint(), agentName,
+ this.client.getServiceVersion().getVersion(), contentType, accept, updateAgentRequest, requestOptions,
+ Context.NONE);
}
/**
- * Create an agent from a manifest
- *
- * Imports the provided manifest to create an agent and returns the created resource.
- * Request Body Schema
- *
- *
- * {@code
- * {
- * name: String (Required)
- * metadata (Optional): {
- * String: String (Required)
- * }
- * description: String (Optional)
- * manifest_id: String (Required)
- * parameter_values (Required): {
- * String: BinaryData (Required)
- * }
- * }
- * }
- *
+ * Update a code-based agent
*
+ * Updates a code-based agent by uploading new code and creating a new version.
+ * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
* Response Body Schema
*
*
@@ -1279,6 +1757,7 @@ public Mono> createAgentFromManifestWithResponseAsync(
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1350,46 +1829,38 @@ public Mono> createAgentFromManifestWithResponseAsync(
* }
*
*
- * @param createAgentFromManifestRequest The createAgentFromManifestRequest parameter.
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
* @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 the response body along with {@link Response}.
+ * @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response createAgentFromManifestWithResponse(BinaryData createAgentFromManifestRequest,
- RequestOptions requestOptions) {
- final String contentType = "application/json";
+ public Mono> updateAgentFromCodeWithResponseAsync(String agentName, String codeZipSha256,
+ BinaryData content, RequestOptions requestOptions) {
+ final String contentType = "multipart/form-data";
final String accept = "application/json";
- return service.createAgentFromManifestSync(this.client.getEndpoint(),
- this.client.getServiceVersion().getVersion(), contentType, accept, createAgentFromManifestRequest,
- requestOptions, Context.NONE);
+ return FluxUtil
+ .withContext(context -> service.updateAgentFromCode(this.client.getEndpoint(), agentName, contentType,
+ codeZipSha256, this.client.getServiceVersion().getVersion(), accept, content, requestOptions, context));
}
/**
- * Update an agent from a manifest
- *
- * Updates the agent from a manifest by adding a new version if there are any changes to the agent definition.
- * If no changes, returns the existing agent version.
- * Request Body Schema
- *
- *
- * {@code
- * {
- * metadata (Optional): {
- * String: String (Required)
- * }
- * description: String (Optional)
- * manifest_id: String (Required)
- * parameter_values (Required): {
- * String: BinaryData (Required)
- * }
- * }
- * }
- *
+ * Update a code-based agent
*
+ * Updates a code-based agent by uploading new code and creating a new version.
+ * If the code and definition are unchanged (matched by x-ms-code-zip-sha256 header), returns the existing version.
+ * The request body is multipart/form-data with a JSON metadata part and a binary code part (part order is
+ * irrelevant).
+ * Maximum upload size is 250 MB.
* Response Body Schema
*
*
@@ -1398,6 +1869,7 @@ public Response createAgentFromManifestWithResponse(BinaryData creat
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1469,35 +1941,39 @@ public Response createAgentFromManifestWithResponse(BinaryData creat
* }
*
*
- * @param agentName The name of the agent to update.
- * @param updateAgentFromManifestRequest The updateAgentFromManifestRequest parameter.
+ * @param agentName The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
+ * - Must start and end with alphanumeric characters,
+ * - Can contain hyphens in the middle
+ * - Must not exceed 63 characters.
+ * @param codeZipSha256 SHA-256 hex digest of the uploaded code zip. Used for change detection (dedup) and integrity
+ * verification.
+ * @param content The content parameter.
* @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 the response body along with {@link Response} on successful completion of {@link Mono}.
+ * @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> updateAgentFromManifestWithResponseAsync(String agentName,
- BinaryData updateAgentFromManifestRequest, RequestOptions requestOptions) {
- final String contentType = "application/json";
+ public Response updateAgentFromCodeWithResponse(String agentName, String codeZipSha256,
+ BinaryData content, RequestOptions requestOptions) {
+ final String contentType = "multipart/form-data";
final String accept = "application/json";
- return FluxUtil.withContext(context -> service.updateAgentFromManifest(this.client.getEndpoint(), agentName,
- this.client.getServiceVersion().getVersion(), contentType, accept, updateAgentFromManifestRequest,
- requestOptions, context));
+ return service.updateAgentFromCodeSync(this.client.getEndpoint(), agentName, contentType, codeZipSha256,
+ this.client.getServiceVersion().getVersion(), accept, content, requestOptions, Context.NONE);
}
/**
- * Update an agent from a manifest
+ * Create an agent from a manifest
*
- * Updates the agent from a manifest by adding a new version if there are any changes to the agent definition.
- * If no changes, returns the existing agent version.
+ * Imports the provided manifest to create an agent and returns the created resource.
* Request Body Schema
*
*
* {@code
* {
+ * name: String (Required)
* metadata (Optional): {
* String: String (Required)
* }
@@ -1518,6 +1994,7 @@ public Mono> updateAgentFromManifestWithResponseAsync(Strin
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1589,136 +2066,46 @@ public Mono> updateAgentFromManifestWithResponseAsync(Strin
* }
*
*
- * @param agentName The name of the agent to update.
- * @param updateAgentFromManifestRequest The updateAgentFromManifestRequest parameter.
+ * @param createAgentFromManifestRequest The createAgentFromManifestRequest parameter.
* @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 the response body along with {@link Response}.
+ * @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response updateAgentFromManifestWithResponse(String agentName,
- BinaryData updateAgentFromManifestRequest, RequestOptions requestOptions) {
+ public Mono> createAgentFromManifestWithResponseAsync(
+ BinaryData createAgentFromManifestRequest, RequestOptions requestOptions) {
final String contentType = "application/json";
final String accept = "application/json";
- return service.updateAgentFromManifestSync(this.client.getEndpoint(), agentName,
- this.client.getServiceVersion().getVersion(), contentType, accept, updateAgentFromManifestRequest,
- requestOptions, Context.NONE);
+ return FluxUtil.withContext(context -> service.createAgentFromManifest(this.client.getEndpoint(),
+ this.client.getServiceVersion().getVersion(), contentType, accept, createAgentFromManifestRequest,
+ requestOptions, context));
}
/**
- * Delete an agent
+ * Create an agent from a manifest
*
- * Deletes an agent. For hosted agents, if any version has active sessions, the request
- * is rejected with HTTP 409 unless `force` is set to true. When force is true, all
- * associated sessions are cascade-deleted along with the agent and its versions.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | force | Boolean | No | For Hosted Agents, if `true`, force-deletes the agent even if
- * its versions have active sessions, cascading deletion to all associated sessions. The service defaults to `false`
- * if a value is not specified by the caller. This value is not relevant for other Agent types. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Response Body Schema
+ * Imports the provided manifest to create an agent and returns the created resource.
+ * Request Body Schema
*
*
* {@code
* {
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* name: String (Required)
- * deleted: boolean (Required)
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * description: String (Optional)
+ * manifest_id: String (Required)
+ * parameter_values (Required): {
+ * String: BinaryData (Required)
+ * }
* }
* }
*
*
- * @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} on successful completion of {@link Mono}.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> internalDeleteAgentWithResponseAsync(String agentName,
- RequestOptions requestOptions) {
- final String accept = "application/json";
- return FluxUtil.withContext(context -> service.internalDeleteAgent(this.client.getEndpoint(), agentName,
- this.client.getServiceVersion().getVersion(), accept, requestOptions, context));
- }
-
- /**
- * Delete an agent
- *
- * Deletes an agent. For hosted agents, if any version has active sessions, the request
- * is rejected with HTTP 409 unless `force` is set to true. When force is true, all
- * associated sessions are cascade-deleted along with the agent and its versions.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | force | Boolean | No | For Hosted Agents, if `true`, force-deletes the agent even if
- * its versions have active sessions, cascading deletion to all associated sessions. The service defaults to `false`
- * if a value is not specified by the caller. This value is not relevant for other Agent types. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
- * Response Body Schema
- *
- *
- * {@code
- * {
- * object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
- * name: String (Required)
- * deleted: boolean (Required)
- * }
- * }
- *
- *
- * @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}.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response internalDeleteAgentWithResponse(String agentName, RequestOptions requestOptions) {
- final String accept = "application/json";
- return service.internalDeleteAgentSync(this.client.getEndpoint(), agentName,
- this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE);
- }
-
- /**
- * List agents
- *
- * Returns a paged collection of agent resources.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | kind | String | No | Filter agents by kind. If not provided, all agents are returned.
- * Allowed values: "prompt", "hosted", "workflow", "external". |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
* Response Body Schema
*
*
@@ -1727,6 +2114,7 @@ public Response internalDeleteAgentWithResponse(String agentName, Re
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1798,50 +2186,46 @@ public Response internalDeleteAgentWithResponse(String agentName, Re
* }
*
*
+ * @param createAgentFromManifestRequest The createAgentFromManifestRequest parameter.
* @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 the response data for a requested list of items along with {@link PagedResponse} on successful completion
- * of {@link Mono}.
+ * @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- private Mono> listAgentsSinglePageAsync(RequestOptions requestOptions) {
+ public Response createAgentFromManifestWithResponse(BinaryData createAgentFromManifestRequest,
+ RequestOptions requestOptions) {
+ final String contentType = "application/json";
final String accept = "application/json";
- return FluxUtil
- .withContext(context -> service.listAgents(this.client.getEndpoint(),
- this.client.getServiceVersion().getVersion(), accept, requestOptions, context))
- .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
- getValues(res.getValue(), "data"), null, null));
+ return service.createAgentFromManifestSync(this.client.getEndpoint(),
+ this.client.getServiceVersion().getVersion(), contentType, accept, createAgentFromManifestRequest,
+ requestOptions, Context.NONE);
}
/**
- * List agents
+ * Update an agent from a manifest
+ *
+ * Updates the agent from a manifest by adding a new version if there are any changes to the agent definition.
+ * If no changes, returns the existing agent version.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * description: String (Optional)
+ * manifest_id: String (Required)
+ * parameter_values (Required): {
+ * String: BinaryData (Required)
+ * }
+ * }
+ * }
+ *
*
- * Returns a paged collection of agent resources.
- * Query Parameters
- *
- * Query Parameters
- * | Name | Type | Required | Description |
- * | kind | String | No | Filter agents by kind. If not provided, all agents are returned.
- * Allowed values: "prompt", "hosted", "workflow", "external". |
- * | limit | Integer | No | A limit on the number of objects to be returned. Limit can range
- * between 1 and 100, and the
- * default is 20. |
- * | order | String | No | Sort order by the `created_at` timestamp of the objects. `asc`
- * for ascending order and`desc`
- * for descending order. Allowed values: "asc", "desc". |
- * | after | String | No | A cursor for use in pagination. `after` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include after=obj_foo in order to fetch the next page of the list. |
- * | before | String | No | A cursor for use in pagination. `before` is an object ID that
- * defines your place in the list.
- * For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
- * subsequent call can include before=obj_foo in order to fetch the previous page of the list. |
- *
- * You can add these to a request with {@link RequestOptions#addQueryParam}
* Response Body Schema
*
*
@@ -1850,6 +2234,7 @@ private Mono> listAgentsSinglePageAsync(RequestOptions
* object: String(agent/agent.version/agent.deleted/agent.version.deleted/agent.container) (Required)
* id: String (Required)
* name: String (Required)
+ * state: String(enabled/disabled) (Required)
* versions (Required): {
* latest (Required): {
* metadata (Required): {
@@ -1921,44 +2306,47 @@ private Mono> listAgentsSinglePageAsync(RequestOptions
* }
*
*
+ * @param agentName The name of the agent to update.
+ * @param updateAgentFromManifestRequest The updateAgentFromManifestRequest parameter.
* @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 the response data for a requested list of items as paginated response with {@link PagedFlux}.
+ * @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listAgentsAsync(RequestOptions requestOptions) {
- return new PagedFlux<>(() -> listAgentsSinglePageAsync(requestOptions));
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> updateAgentFromManifestWithResponseAsync(String agentName,
+ BinaryData updateAgentFromManifestRequest, RequestOptions requestOptions) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.updateAgentFromManifest(this.client.getEndpoint(), agentName,
+ this.client.getServiceVersion().getVersion(), contentType, accept, updateAgentFromManifestRequest,
+ requestOptions, context));
}
/**
- * List agents
+ * Update an agent from a manifest
+ *
+ * Updates the agent from a manifest by adding a new version if there are any changes to the agent definition.
+ * If no changes, returns the existing agent version.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * metadata (Optional): {
+ * String: String (Required)
+ * }
+ * description: String (Optional)
+ * manifest_id: String (Required)
+ * parameter_values (Required): {
+ * String: BinaryData (Required)
+ * }
+ * }
+ * }
+ *
*
- * Returns a paged collection of agent resources.
- * Query Parameters
- *
- * Query Parameters
- * |