Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static Workflow Build<TInput>(
/// <see cref="ChatMessage"/>, <see cref="System.Collections.Generic.IEnumerable{T}"/> of
/// <see cref="ChatMessage"/>, <see cref="string"/>, and <see cref="TurnToken"/>. This
/// makes the workflow usable both for direct invocation and for hosting via
/// <see cref="WorkflowHostingExtensions.AsAIAgent(Workflow, string?, string?, string?, IWorkflowExecutionEnvironment?, bool, bool)"/>.
/// <see cref="WorkflowHostingExtensions.AsAIAgent(Workflow, string?, string?, string?, IWorkflowExecutionEnvironment?, bool, bool, ChatHistoryProvider?)"/>.
/// </remarks>
public static Workflow Build<TInput>(
TextReader yamlReader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Microsoft.Agents.AI.Workflows.Declarative.Interpreter;
/// <see cref="ChatMessage"/><c>[]</c>, and <see cref="TurnToken"/> so that the workflow
/// satisfies <see cref="ChatProtocolExtensions.IsChatProtocol"/>. This makes the workflow
/// usable both for direct <c>Run.SendMessageAsync(input)</c> invocations and for hosting
/// via <see cref="WorkflowHostingExtensions.AsAIAgent(Workflow, string?, string?, string?, IWorkflowExecutionEnvironment?, bool, bool)"/>.
/// via <see cref="WorkflowHostingExtensions.AsAIAgent(Workflow, string?, string?, string?, IWorkflowExecutionEnvironment?, bool, bool, ChatHistoryProvider?)"/>.
///
/// <para>
/// Each non-<see cref="TurnToken"/> input drives the declarative graph forward
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/Microsoft.Agents.AI.Workflows/Futures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class Futures
/// <c>[Obsolete]</c> in v2.0.0 when the new behavior becomes default, and removed in v3.0.0.
/// </para>
/// <para>
/// <b>Interaction with <see cref="WorkflowHostingExtensions.AsAIAgent"/>.</b> When this flag
/// <b>Interaction with <see cref="WorkflowHostingExtensions.AsAIAgent(Workflow, string?, string?, string?, IWorkflowExecutionEnvironment?, bool, bool, ChatHistoryProvider?)"/>.</b> When this flag
/// is <see langword="true"/>, <see cref="AgentResponseEvent"/> joins
/// <see cref="AgentResponseUpdateEvent"/> in being forwarded out of the agent surface
/// unconditionally — neither honors the host's <c>includeWorkflowOutputsInResponse</c>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#nullable enable
*REMOVED*static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.get -> Microsoft.Agents.AI.ChatHistoryProvider?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.get -> Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.WorkflowAgentOptions() -> void
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, Microsoft.Agents.AI.Workflows.WorkflowAgentOptions! options) -> Microsoft.Agents.AI.AIAgent!
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false, Microsoft.Agents.AI.ChatHistoryProvider? chatHistoryProvider = null) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(object! sharedStateKey, System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#nullable enable
*REMOVED*static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.get -> Microsoft.Agents.AI.ChatHistoryProvider?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.get -> Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.WorkflowAgentOptions() -> void
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, Microsoft.Agents.AI.Workflows.WorkflowAgentOptions! options) -> Microsoft.Agents.AI.AIAgent!
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false, Microsoft.Agents.AI.ChatHistoryProvider? chatHistoryProvider = null) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(object! sharedStateKey, System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#nullable enable
*REMOVED*static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.get -> Microsoft.Agents.AI.ChatHistoryProvider?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.get -> Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.WorkflowAgentOptions() -> void
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, Microsoft.Agents.AI.Workflows.WorkflowAgentOptions! options) -> Microsoft.Agents.AI.AIAgent!
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false, Microsoft.Agents.AI.ChatHistoryProvider? chatHistoryProvider = null) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(object! sharedStateKey, System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#nullable enable
*REMOVED*static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.get -> Microsoft.Agents.AI.ChatHistoryProvider?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.get -> Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.WorkflowAgentOptions() -> void
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, Microsoft.Agents.AI.Workflows.WorkflowAgentOptions! options) -> Microsoft.Agents.AI.AIAgent!
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false, Microsoft.Agents.AI.ChatHistoryProvider? chatHistoryProvider = null) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(object! sharedStateKey, System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#nullable enable
*REMOVED*static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.get -> Microsoft.Agents.AI.ChatHistoryProvider?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ChatHistoryProvider.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Description.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.get -> Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.ExecutionEnvironment.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Id.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeExceptionDetails.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.get -> bool
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.IncludeWorkflowOutputsInResponse.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.get -> string?
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.Name.set -> void
Microsoft.Agents.AI.Workflows.WorkflowAgentOptions.WorkflowAgentOptions() -> void
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, Microsoft.Agents.AI.Workflows.WorkflowAgentOptions! options) -> Microsoft.Agents.AI.AIAgent!
static Microsoft.Agents.AI.Workflows.WorkflowHostingExtensions.AsAIAgent(this Microsoft.Agents.AI.Workflows.Workflow! workflow, string? id = null, string? name = null, string? description = null, Microsoft.Agents.AI.Workflows.IWorkflowExecutionEnvironment? executionEnvironment = null, bool includeExceptionDetails = false, bool includeWorkflowOutputsInResponse = false, Microsoft.Agents.AI.ChatHistoryProvider? chatHistoryProvider = null) -> Microsoft.Agents.AI.AIAgent!
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(object! sharedStateKey, System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Microsoft.Agents.AI.Workflows.Executor.RegisterCheckpointRestoringCallback(System.Func<Microsoft.Agents.AI.Workflows.IWorkflowContext!, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callback) -> void
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright (c) Microsoft. All rights reserved.

using Microsoft.Extensions.AI;

namespace Microsoft.Agents.AI.Workflows;

/// <summary>
/// Configuration options for hosting a <see cref="Workflow"/> as an <see cref="AIAgent"/>.
/// </summary>
public sealed class WorkflowAgentOptions
{
/// <summary>
/// Gets or sets a unique id for the hosting <see cref="AIAgent"/>.
/// </summary>
public string? Id { get; set; }

/// <summary>
/// Gets or sets a name for the hosting <see cref="AIAgent"/>.
/// </summary>
public string? Name { get; set; }

/// <summary>
/// Gets or sets a description for the hosting <see cref="AIAgent"/>.
/// </summary>
public string? Description { get; set; }

/// <summary>
/// Gets or sets the execution environment to use when running the workflow. See
/// <see cref="InProcessExecution.OffThread"/>, <see cref="InProcessExecution.Concurrent"/> and
/// <see cref="InProcessExecution.Lockstep"/> for the in-process environments.
/// </summary>
public IWorkflowExecutionEnvironment? ExecutionEnvironment { get; set; }

/// <summary>
/// Gets or sets a value indicating whether <see cref="System.Exception.Message"/> should be included
/// in the <see cref="ErrorContent"/> representing the workflow error.
/// </summary>
public bool IncludeExceptionDetails { get; set; }

/// <summary>
/// Gets or sets a value indicating whether outgoing workflow outputs should be transformed
/// into content in <see cref="AgentResponseUpdate"/>s or the <see cref="AgentResponse"/> as appropriate.
/// </summary>
public bool IncludeWorkflowOutputsInResponse { get; set; }

/// <summary>
/// Gets or sets the <see cref="ChatHistoryProvider"/> used to store the conversation history of the hosting <see cref="AIAgent"/>.
/// </summary>
/// <remarks>
/// <para>
/// When set, the provider is notified via <see cref="ChatHistoryProvider.InvokedAsync"/> at the end of each run
/// with the request messages and the response messages, and it can be retrieved from the agent via
/// <see cref="AIAgent.GetService(System.Type, object?)"/>.
/// </para>
/// <para>
/// The workflow maintains its own conversation state, so only the new request messages are passed to the workflow on each run,
/// and the provider is not asked to supply prior chat history via <see cref="ChatHistoryProvider.InvokingAsync"/>.
/// </para>
/// <para>
/// When <see langword="null"/>, a default in-memory provider that stores the history in the session is used.
/// </para>
/// </remarks>
public ChatHistoryProvider? ChatHistoryProvider { get; set; }

internal WorkflowAgentOptions Clone() => (WorkflowAgentOptions)this.MemberwiseClone();
}
Loading
Loading