AgentApprovalGuard class
Accepts one decision per approval request.
A reader can press Allow twice, or Allow and then Deny, before the host records the first decision. The guard takes the first and refuses the rest, until the host shows a new request: a different call id, or the same call back in AgentToolCallStatus.awaitingApproval. A host whose request failed can also leave the call awaiting approval and call rearm.
Constructors
- AgentApprovalGuard({required String id, required AgentToolCallStatus status, AgentApprovalDecision? recorded})
-
Creates a guard for the call
idinstatus, adoptingrecorded.
Properties
- canDecide → bool
-
Whether a decision can be taken now: the call needs one and none was
taken for this request.
no setter
- decision → AgentApprovalDecision?
-
The decision taken for the current request, or null before one.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The call the guard watches.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → AgentToolCallStatus
-
The call's latest status.
no setter
Methods
-
decide(
AgentApprovalDecision decision) → bool -
Takes
decisionif canDecide; returns whether it was taken. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rearm(
) → void - Forgets the decision taken for the current request, so the reader can decide again.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
{required String id, required AgentToolCallStatus status, AgentApprovalDecision? recorded}) → void -
Records the call's latest
idandstatus.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited