Skip to content

IAgentScenario

NexusLabs.Needlr.AgentFramework.Testing

IAgentScenario Interface

Defines a self-contained agent test scenario with seed → execute → verify lifecycle. Scenarios are discovered automatically when registered via DI.

public interface IAgentScenario

Remarks

Each scenario declares its own system prompt, user prompt, and workspace seed data. The AgentScenarioRunner handles workspace creation, context scoping, diagnostics capture, and invokes Verify(IWorkspace, IAgentRunDiagnostics) after execution.

For multi-agent pipeline scenarios, consumers can implement custom runner logic that coordinates multiple agents using the scenario's prompts and workspace.

Properties

IAgentScenario.Description Property

Gets a human-readable description of what the scenario tests.

string Description { get; }

Property Value

System.String

IAgentScenario.Name Property

Gets the scenario name (used for selection and reporting).

string Name { get; }

Property Value

System.String

IAgentScenario.SystemPrompt Property

Gets the system prompt (agent instructions) for this scenario.

string SystemPrompt { get; }

Property Value

System.String

IAgentScenario.UserPrompt Property

Gets the user message that starts the agent run.

string UserPrompt { get; }

Property Value

System.String

Methods

IAgentScenario.SeedWorkspace(IWorkspace) Method

Populates the workspace with files needed before the agent runs. Called by the runner before execution begins.

void SeedWorkspace(NexusLabs.Needlr.AgentFramework.Workspace.IWorkspace workspace);

Parameters

workspace NexusLabs.Needlr.AgentFramework.Workspace.IWorkspace

The workspace to seed with test data.

IAgentScenario.Verify(IWorkspace, IAgentRunDiagnostics) Method

Verifies the scenario's expected outcomes after the agent run completes. Throw an exception (e.g., ScenarioVerificationException) to indicate failure.

void Verify(NexusLabs.Needlr.AgentFramework.Workspace.IWorkspace workspace, NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentRunDiagnostics? diagnostics);

Parameters

workspace NexusLabs.Needlr.AgentFramework.Workspace.IWorkspace

The workspace after agent execution (contains any files the agent wrote).

diagnostics NexusLabs.Needlr.AgentFramework.Diagnostics.IAgentRunDiagnostics

Diagnostics from the run, or null if diagnostics were not captured.