AgentTool class final
A tool the model may invoke: name, description, JSON-schema parameters, and the Dart callback that executes it.
Extends Tool, so instances go directly into AgentState.tools / Context.tools. Register tools in a ToolRegistry to get lookup, argument validation, and a ToolExecutor adapter for the agent loop.
Constructors
-
AgentTool({required String name, required String description, Map<
String, dynamic> parameters = const <String, dynamic>{}, required AgentToolExecute execute, ToolExecutionMode? executionMode, String? label, ApprovalTier tier = ApprovalTier.exec}) -
Creates an AgentTool.
parametersis the JSON Schema for the arguments; seeparam_validator.dartfor the enforced subset.const
Properties
- description → String
-
Human- and model-readable description of what the tool does.
finalinherited
- execute → AgentToolExecute
-
Executes one tool call with validated arguments. See AgentToolExecute.
final
- executionMode → ToolExecutionMode?
-
Per-tool execution mode override (ported from pi):
ToolExecutionMode.sequential forces the whole tool-call batch that
contains this tool to execute one call at a time, even when the loop
default is ToolExecutionMode.parallel.
nullkeeps the loop default.final - hashCode → int
-
The hash code for this object.
no setterinherited
- label → String?
-
Human-readable label for UI display (ported from pi). Optional.
final
- name → String
-
The tool's name (what the model calls).
finalinherited
-
parameters
→ Map<
String, dynamic> -
JSON Schema for the tool's arguments.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tier → ApprovalTier
-
Capability tier consulted by the approval gate (see
lib/src/approval/): read-only tools declare ApprovalTier.read, workspace-mutating tools ApprovalTier.write, and code-executing tools ApprovalTier.exec. The default — ApprovalTier.exec — is the safe choice for unknown custom tools (omp semantics).final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited