Skip to content

AgentRunner ​

Category: Agent

Source: agent_runner.dart

Enums ​

ToolApprovalPolicy ​

Policy for automatic tool approval in headless execution.

Classes ​

AgentRunner ​

Runs an [AgentCore] to completion without interactive approval.

Used for subagent execution where the parent agent has already decided the task and tools should run without human intervention.

Constructor ​

dart
AgentRunner({
    required this.core,
    required this.policy,
    Set<String>? allowedTools,
    this.onEvent,
  })

Properties ​

PropertyTypeDescription
coreAgentCore
policyToolApprovalPolicy
statsUsageStatsCumulative usage observed during this runner's lifetime. Surfaces the subagent's token cost back to the parent — without this, every subagent's AgentCore.stats would be discarded when the manager returns.

Methods ​

Future&lt;String&gt; runToCompletion(String userMessage) ​

Runs a [userMessage] through the agent loop until completion.

Returns the concatenated assistant text output.

Released under the MIT License.