mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
b25b0af49b
* refactor: Unify ExecutorIsh and ExecutorRegistration => ExecutorBinding * Switch to more modern Record type-tree for Sum Types * Unify APIs for getting ExecutorBinding * Fix an issue where workflows consisting entirely of cross-run shareable executors which are not instance-resettable do not properly clear state when running non-concurrently. * feat: Simplify function-to-executor pattern * refactor: Normalize API naming
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Shared.Diagnostics;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows;
|
|
|
|
// TODO: Unwrap the Configured object, just like for SubworkflowBinding
|
|
internal record ConfiguredExecutorBinding(Configured<Executor> ConfiguredExecutor, Type ExecutorType)
|
|
: ExecutorBinding(Throw.IfNull(ConfiguredExecutor).Id,
|
|
ConfiguredExecutor.BoundFactoryAsync,
|
|
ExecutorType,
|
|
ConfiguredExecutor.Raw)
|
|
{
|
|
/// <inheritdoc/>
|
|
public override bool IsSharedInstance { get; } = ConfiguredExecutor.Raw is Executor;
|
|
|
|
protected override async ValueTask<bool> ResetCoreAsync()
|
|
{
|
|
if (this.ConfiguredExecutor.Raw is IResettableExecutor resettable)
|
|
{
|
|
await resettable.ResetAsync().ConfigureAwait(false);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public override bool SupportsConcurrentSharedExecution => true;
|
|
|
|
/// <inheritdoc/>
|
|
public override bool SupportsResetting => false;
|
|
}
|