mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
331c750515
* refactor: remove unused internals * feat: Execution Mode for sharing a workflow among concurrent runs * feat: Update WorkflowHostAgent to support concurrent execution * Also update AsAgent APIs to support injecting a CheckpointManager and an IWorkflowExecutionEnvironment * fix: Make Read logic consistent in DeclarativeWorkflowContext
29 lines
889 B
C#
29 lines
889 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Collections.Concurrent;
|
|
using System.Threading;
|
|
using Microsoft.Agents.AI.Workflows.Execution;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows.UnitTests;
|
|
|
|
internal sealed class TestRunState
|
|
{
|
|
public ConcurrentDictionary<string, ConcurrentQueue<object>> SentMessages = new();
|
|
public StateManager StateManager { get; } = new();
|
|
public ConcurrentQueue<WorkflowEvent> EmittedEvents { get; } = new();
|
|
public ConcurrentDictionary<string, ConcurrentQueue<object>> YieldedOutputs { get; } = new();
|
|
|
|
private int _haltRequests;
|
|
public int HaltRequests
|
|
{
|
|
get => Volatile.Read(ref this._haltRequests);
|
|
}
|
|
|
|
public void IncrementHaltRequests()
|
|
{
|
|
Interlocked.Increment(ref this._haltRequests);
|
|
}
|
|
|
|
public TestWorkflowContext ContextFor(string executorId) => new(executorId, this);
|
|
}
|