// Copyright (c) Microsoft. All rights reserved. using System; using System.Diagnostics; using Microsoft.Agents.AI.Workflows.Observability; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Shared.Diagnostics; namespace Microsoft.Agents.AI.Workflows.Declarative; /// /// Configuration options for workflow execution. /// public sealed class DeclarativeWorkflowOptions(ResponseAgentProvider agentProvider) { /// /// Defines the agent provider. /// public ResponseAgentProvider AgentProvider { get; } = Throw.IfNull(agentProvider); /// /// Gets or sets the MCP tool handler for invoking MCP tools within workflows. /// If not set, MCP tool invocations will fail with an appropriate error message. /// public IMcpToolHandler? McpToolHandler { get; init; } /// /// Defines the configuration settings for the workflow. /// public IConfiguration? Configuration { get; init; } /// /// Optionally identifies a continued workflow conversation. /// public string? ConversationId { get; init; } /// /// Defines the maximum number of nested calls allowed in a PowerFx formula. /// public int? MaximumCallDepth { get; init; } /// /// Defines the maximum allowed length for expressions evaluated in the workflow. /// public int? MaximumExpressionLength { get; init; } /// /// Gets the used to create loggers for workflow components. /// public ILoggerFactory LoggerFactory { get; init; } = NullLoggerFactory.Instance; /// /// Gets the callback to configure telemetry options. /// public Action? ConfigureTelemetry { get; init; } /// /// Gets an optional for telemetry. /// If provided, the caller retains ownership and is responsible for disposal. /// If but is set, a shared default /// activity source named "Microsoft.Agents.AI.Workflows" will be used. /// public ActivitySource? TelemetryActivitySource { get; init; } /// /// Gets a value indicating whether telemetry is enabled. /// Telemetry is enabled when either or is set. /// internal bool IsTelemetryEnabled => this.ConfigureTelemetry is not null || this.TelemetryActivitySource is not null; }