HarnessScenarioRunner
NexusLabs.Foundry.MicrosoftAgentFramework.Testing¶
HarnessScenarioRunner Class¶
Runs IHarnessScenario instances through a deterministic generated-tool, workspace, execution-context, session, and verification lifecycle.
Inheritance System.Object 🡒 HarnessScenarioRunner
Remarks¶
Agent construction remains scenario-owned so this package does not reference the optional complete-Harness package. Generated functions are resolved exclusively through NexusLabs.Foundry.MicrosoftAgentFramework.AgentFrameworkGeneratedBootstrap; no reflection fallback is available.
Constructors¶
HarnessScenarioRunner(IServiceProvider, IAgentExecutionContextAccessor) Constructor¶
Initializes a Harness scenario runner.
public HarnessScenarioRunner(System.IServiceProvider services, NexusLabs.Foundry.MicrosoftAgentFramework.Context.IAgentExecutionContextAccessor contextAccessor);
Parameters¶
services System.IServiceProvider
Services used to activate generated function groups.
contextAccessor NexusLabs.Foundry.MicrosoftAgentFramework.Context.IAgentExecutionContextAccessor
The trusted execution-context accessor scoped around the run.
Exceptions¶
System.ArgumentNullException
services or contextAccessor is null.
System.InvalidOperationException
services does not expose an Microsoft.Extensions.DependencyInjection.IServiceScopeFactory.
Methods¶
HarnessScenarioRunner.RunAsync(IHarnessScenario) Method¶
Runs a scenario without cancellation.
public System.Threading.Tasks.Task<NexusLabs.Foundry.MicrosoftAgentFramework.Testing.HarnessScenarioRunResult> RunAsync(NexusLabs.Foundry.MicrosoftAgentFramework.Testing.IHarnessScenario scenario);
Parameters¶
scenario IHarnessScenario
The scenario to run.
Returns¶
System.Threading.Tasks.Task<HarnessScenarioRunResult>
The completed scenario result.
Exceptions¶
System.ArgumentNullException
scenario is null.
HarnessScenarioToolResolutionException
Generated functions are unavailable, missing, or duplicated.
HarnessScenarioRunner.RunAsync(IHarnessScenario, CancellationToken) Method¶
Runs a scenario with cancellation.
public System.Threading.Tasks.Task<NexusLabs.Foundry.MicrosoftAgentFramework.Testing.HarnessScenarioRunResult> RunAsync(NexusLabs.Foundry.MicrosoftAgentFramework.Testing.IHarnessScenario scenario, System.Threading.CancellationToken cancellationToken);
Parameters¶
scenario IHarnessScenario
The scenario to run.
cancellationToken System.Threading.CancellationToken
Cancels agent construction or execution.
Returns¶
System.Threading.Tasks.Task<HarnessScenarioRunResult>
The completed scenario result.
Exceptions¶
System.ArgumentNullException
scenario is null.
HarnessScenarioToolResolutionException
Generated functions are unavailable, missing, or duplicated.
Remarks¶
Construction, session, execution, and cancellation exceptions are captured in ExecutionError so verification receives the same failure evidence as the existing AgentScenarioRunner.