Class WorkflowTestHarness.Builder

java.lang.Object
com.agentforge4j.testkit.harness.WorkflowTestHarness.Builder
Enclosing class:
WorkflowTestHarness

public static final class WorkflowTestHarness.Builder extends Object
Fluent builder for WorkflowTestHarness. workflowsDir and script are required; agentsDir is optional (agents bundled inside the workflow need none) and the clock defaults to a fixed epoch clock for deterministic event timestamps.
  • Method Details

    • workflowsDir

      public WorkflowTestHarness.Builder workflowsDir(Path value)
      Sets the directory the config-loader scans for workflow bundles. Required unless shippedCatalog(boolean) is enabled; mutually exclusive with it.
      Parameters:
      value - workflows directory; must not be null
      Returns:
      this builder
    • shippedCatalog

      public WorkflowTestHarness.Builder shippedCatalog(boolean value)
      Loads the real shipped workflow + agent catalog from the classpath (the production loadShippedWorkflows / loadShippedAgents path) instead of a fixtures directory. Mutually exclusive with workflowsDir(Path) / agentsDir(Path).
      Parameters:
      value - true to verify the genuine shipped catalog
      Returns:
      this builder
    • agentsDir

      public WorkflowTestHarness.Builder agentsDir(Path value)
      Sets the directory the config-loader scans for standalone agent bundles. Optional — omit when the fixture bundles its agents inside the workflow.
      Parameters:
      value - agents directory; must not be null
      Returns:
      this builder
    • script

      public WorkflowTestHarness.Builder script(FakeScript value)
      Sets the parsed fake script served to every run.
      Parameters:
      value - the script; must not be null
      Returns:
      this builder
    • clock

      public WorkflowTestHarness.Builder clock(Clock value)
      Overrides the clock used for deterministic event timestamps.
      Parameters:
      value - the clock; must not be null
      Returns:
      this builder
    • fileSinkDir

      public WorkflowTestHarness.Builder fileSinkDir(Path value)
      Routes CREATE_FILE writes to the production LocalFileSink rooted at the given directory — exercising the real path-traversal guard and writing to disk — instead of the default CapturingFileSink that records writes verbatim without filesystem enforcement. When set, WorkflowRunResult.captures() carries no captured files; assert against the directory instead.
      Parameters:
      value - root directory for file writes; must not be null
      Returns:
      this builder
    • toolProviders

      public WorkflowTestHarness.Builder toolProviders(List<ToolProvider> value)
      Wires in-process tool providers so an agent's TOOL_INVOCATION resolves to a real provider without a network transport. The capability in the command is matched against each provider's listTools() descriptors.
      Parameters:
      value - tool providers; must not be null (defensively copied)
      Returns:
      this builder
    • toolPolicy

      public WorkflowTestHarness.Builder toolPolicy(ToolPolicy value)
      Overrides the tool policy evaluated before a tool invocation. Defaults to the bootstrap's secure-by-default policy (SecureDefaultToolPolicy) when unset; supply ToolPolicy.allowAll() or a custom policy returning RequireApproval or Deny to exercise the approval/decision suspend-resume paths.
      Parameters:
      value - the tool policy; must not be null
      Returns:
      this builder
    • toolExecutionOptions

      public WorkflowTestHarness.Builder toolExecutionOptions(ToolExecutionOptions value)
      Overrides the tool-invocation tunables, most usefully the authoritative per-invocation timeout — pair a short timeout with a deliberately hanging provider to exercise the timeout arm of the governance chokepoint. Defaults to the bootstrap's ToolExecutionOptions.defaults() when unset.
      Parameters:
      value - the options; must not be null
      Returns:
      this builder
    • build

      public WorkflowTestHarness build()
      Builds the harness.
      Returns:
      a configured WorkflowTestHarness