dryRun<C extends AgentToolContext> static method

Future<List<AgentRunStep>> dryRun<C extends AgentToolContext>(
  1. AgentToolBinding<C> binding,
  2. List<({Map<String, Object?> arguments, String name})> steps
)

The dry run: performs steps against copies of what the binding's context reaches and reports what each would do, so a preview can say which calls would be refused before anything is written.

Every step is attempted, in order, against the copy as the earlier steps left it. A step that needs execution is not performed — running a program is not a simulation — and is reported notSimulated.

Implementation

static Future<List<AgentRunStep>> dryRun<C extends AgentToolContext>(
  AgentToolBinding<C> binding,
  List<({String name, Map<String, Object?> arguments})> steps,
) => _simulate(binding.context.dryRunCopy() as C, binding.registry, [
  for (var i = 0; i < steps.length; i++)
    AgentRunStep(
      index: i + 1,
      toolName: steps[i].name,
      arguments: steps[i].arguments,
    ),
]);