Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Config loader for optimization-ready Azure AI Hosted Agents. Resolves optimized agent configurations from multiple sources using a priority waterfall:
- Resolver API —
OPTIMIZATION_CANDIDATE_ID+OPTIMIZATION_RESOLVE_ENDPOINT - Inline JSON —
OPTIMIZATION_CONFIGenvironment variable - Local candidate directory —
OPTIMIZATION_CANDIDATE_IDset andOPTIMIZATION_LOCAL_DIR/<candidate_id>/exists on disk - Local baseline directory —
OPTIMIZATION_LOCAL_DIR/baseline/exists on disk - Returns
nullwhen no source matches.
Getting started
Install the package
dotnet add package Azure.AI.AgentServer.Optimization --prerelease
Prerequisites
Key concepts
OptimizationOptionsLoader
The main entry point. Call Load() or LoadAsync() to resolve an OptimizationOptions from the highest-priority available source.
OptimizationOptions
A mutable, binder-friendly options object containing:
Instructions— optimized system promptModel— model deployment nameTemperature— sampling temperatureSkills— list of learned skillsToolDefinitions— tool definitions in OpenAI function-calling format
OptimizationSkill
Represents a single learned skill with Name, Description, and Body.
Examples
Load options with defaults
OptimizationOptions options = await OptimizationOptionsLoader.LoadAsync();
if (options is not null)
{
Console.WriteLine($"Source: {options.Source}");
Console.WriteLine($"Instructions: {options.Instructions}");
Console.WriteLine($"Model: {options.Model}");
}
Load options with a custom token provider
LoadOptions loadOptions = new LoadOptions
{
TokenProvider = new MyTokenProvider(),
};
OptimizationOptions options = await OptimizationOptionsLoader.LoadAsync(loadOptions);
Where MyTokenProvider is your AuthenticationTokenProvider implementation:
private sealed class MyTokenProvider : AuthenticationTokenProvider
{
public override GetTokenOptions CreateTokenOptions(IReadOnlyDictionary<string, object> properties) => new(properties);
public override AuthenticationToken GetToken(GetTokenOptions options, CancellationToken cancellationToken) =>
throw new NotImplementedException();
public override ValueTask<AuthenticationToken> GetTokenAsync(GetTokenOptions options, CancellationToken cancellationToken) =>
throw new NotImplementedException();
}
Troubleshooting
When troubleshooting configuration resolution, set the environment variables for the source that you intend to use and inspect the Source property on the returned OptimizationOptions to confirm which source was selected.
Contributing
This project welcomes contributions and suggestions. See CONTRIBUTING.md for details.
Azure SDK for .NET