AgentToolCall class
One tool call, changing in place through its lifecycle.
Most of the time it is a quiet row: the tool's icon, the call's summary, its meta (the detail, the duration and the recorded decision, such as "Allowed once") with the tool id, then the status glyph and word. A call with output opens an output well under the row, which follows the newest line while the tool runs. The well opens while the call works, collapses when it succeeds and stays open when it fails, under policy; a reader's toggle wins for the rest of the run. Output taller than AgentToolCallSpec.outputMaxHeight offers "Show all" and "Show less" independently of opening or closing the well.
While the call is AgentToolCallStatus.awaitingApproval, it shows the approval card instead: a question, the tool id, the description, the input as a data list, and a footer with "Always allow" for this tool on the leading side and Deny and Allow once on the trailing side, primary last. The card takes one decision per request and sends it to onDecision; once the host moves the call on, focus returns to the row.
A renderer registered in AgentToolRenderers for the call's tool replaces the row. Style a status with AgentToolCallStylerStatus.onStatus.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AgentToolCall
Constructors
-
AgentToolCall({Key? key, required AgentToolCallPart call, ValueChanged<
AgentApprovalDecision> ? onDecision, bool offerAlwaysAllow = true, Widget? icon, String? approvalTitle, AgentDisclosurePolicy policy = const AgentDisclosurePolicy(), bool? expanded, bool? defaultExpanded, ValueChanged<bool> ? onExpandedChanged, String statusLabelBuilder(AgentToolCallStatus status)?, String decisionLabelBuilder(AgentApprovalDecision decision)?, String allowOnceLabel = 'Allow once', String alwaysAllowLabel = 'Always allow', String denyLabel = 'Deny', String outputLabel = 'Tool output', String showAllLabel = 'Show all', String showLessLabel = 'Show less', String semanticLabel = 'Tool call', AgentGlyphBuilder? glyphBuilder, DisclosureStyler disclosureStyle = const DisclosureStyler.create(), DataListStyler inputStyle = const DataListStyler.create(), ButtonStyler allowOnceStyle = const ButtonStyler.create(), ButtonStyler alwaysAllowStyle = const ButtonStyler.create(), ButtonStyler denyStyle = const ButtonStyler.create(), AgentToolCallStyler style = const AgentToolCallStyler.create(), AgentToolCallSpec? styleSpec}) -
Creates the row, or the approval card, of
call.const
Properties
- allowOnceLabel → String
-
The label of the card's primary action.
final
- allowOnceStyle → ButtonStyler
-
The style of Allow once.
final
- alwaysAllowLabel → String
-
The label of the card's scoped action, followed by the tool id.
final
- alwaysAllowStyle → ButtonStyler
-
The style of Always allow.
final
- approvalTitle → String?
-
The card's question; defaults to the call's summary as a question.
final
- call → AgentToolCallPart
-
The call to show.
final
- decisionLabelBuilder → String Function(AgentApprovalDecision decision)?
-
Names a recorded decision; defaults to defaultDecisionLabel.
final
- defaultExpanded → bool?
-
Whether the output well starts open when uncontrolled; defaults to
open while the call works or after it failed.
final
- denyLabel → String
-
The label of the card's refusal.
final
- denyStyle → ButtonStyler
-
The style of Deny.
final
- disclosureStyle → DisclosureStyler
-
The style of the disclosure behind the row and the output well.
final
- expanded → bool?
-
Whether the output well is open. Null lets the widget own the state.
final
- glyphBuilder → AgentGlyphBuilder?
-
Draws the glyphs; defaults to the nearest AgentGlyphs.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → Widget?
-
The tool's icon; defaults to AgentGlyphs.toolIconBuilder, then
AgentGlyph.tool.
final
- inputStyle → DataListStyler
-
The style of the card's input list.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- offerAlwaysAllow → bool
-
Whether the card offers to always allow this tool.
final
-
onDecision
→ ValueChanged<
AgentApprovalDecision> ? -
Receives the reader's decision on an approval request, once per
request. Without it, the card's actions are disabled.
final
-
onExpandedChanged
→ ValueChanged<
bool> ? -
Receives every request to open or close the output well.
final
- outputLabel → String
-
The accessible name of the output well.
final
- policy → AgentDisclosurePolicy
-
When the output well opens and closes on its own.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String
-
The call's accessible name.
final
- showAllLabel → String
-
The action that removes the output well's height limit.
final
- showLessLabel → String
-
The action that restores the output well's height limit.
final
- statusLabelBuilder → String Function(AgentToolCallStatus status)?
-
Names a status; defaults to defaultStatusLabel.
final
- style → AgentToolCallStyler
-
The style of the row, the well and the card.
final
- styleSpec → AgentToolCallSpec?
-
A resolved spec that bypasses style.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AgentToolCall> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultDecisionLabel(
AgentApprovalDecision decision) → String - The default name of a recorded decision.
-
defaultStatusLabel(
AgentToolCallStatus status) → String - The default name of a status.