// Copyright (c) Microsoft. All rights reserved.
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.Agents.AI.Hosting.AzureFunctions;
///
/// Provides access to agent-specific options for functions agents by name.
/// Returns when no explicit options have been configured for an agent,
/// which distinguishes standalone agents from those auto-registered by workflows.
///
internal sealed class DefaultFunctionsAgentOptionsProvider(IReadOnlyDictionary functionsAgentOptions)
: IFunctionsAgentOptionsProvider
{
private readonly IReadOnlyDictionary _functionsAgentOptions =
functionsAgentOptions ?? throw new ArgumentNullException(nameof(functionsAgentOptions));
///
/// Attempts to retrieve the options associated with the specified agent name.
/// Returns when no options have been explicitly configured for the agent.
///
/// The name of the agent whose options are to be retrieved. Cannot be null or empty.
///
/// When this method returns , contains the options for the specified agent;
/// otherwise, .
///
/// if options were found for the agent; otherwise, .
public bool TryGet(string agentName, [NotNullWhen(true)] out FunctionsAgentOptions? options)
{
ArgumentException.ThrowIfNullOrEmpty(agentName);
return this._functionsAgentOptions.TryGetValue(agentName, out options);
}
}