AgentToolContext class abstract
What one invocation may reach, and how its calls are recorded.
An application extends it with what its tools need — the resources they address and how a target becomes an AgentGuardTarget — and implements the two transaction operations an agent run needs: runAtomically and dryRunCopy.
Constructors
- AgentToolContext({required AgentInvocation invocation, required AgentAuditLog audit})
Properties
- allowExecution → bool
-
Whether a tool that runs a program may run one. Read from the
invocation; a context cannot be told otherwise.
no setter
- audit → AgentAuditLog
-
Where every call made through this context is recorded.
final
- auditLocatorKey → String
-
The argument key that names the resource a call addresses.
no setter
-
auditTargetKeys
→ List<
String> -
The argument keys that name a call's target, first present wins — what
the audit trail records as
targetId.no setter -
createdIdKeys
→ List<
String> -
The result keys that carry the id of something a call created — how a
dry run replays a recorded call that later calls refer to by that id.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- invocation → AgentInvocation
-
The record this call belongs to — immutable, and the only place
execution consent exists.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → AgentScope
-
The invocation's scope, read by guard.
no setter
Methods
-
callZoneValues(
AgentAuditRecording recording) → Map< Object?, Object?> - Zone values installed for the length of one call, beside its recording — how an application wires the function its writes run through to AgentAuditRecording.recordMutation.
-
dryRunCopy(
) → AgentToolContext - A context over copies of what this one reaches, for a dry run: the same invocation and the same rules, a scratch audit log, and nothing a call does reaching the real resources.
-
guard(
AgentGuardTarget target) → AgentScopeGate? -
The guard's verdict on
targetfor the call running now: the gate that refuses it, or null. The target is guarded as written when the running tool declaresisWrite, as read otherwise. -
nextUndoRef(
) → int -
The next position in this invocation's undo chain — the
undoRefof an applied mutation. One context serves one invocation, so the chain is the context's. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
runAtomically<
T> (String label, Future< T> body()) → Future<T> -
Runs
bodyas one atomic unit over everything this invocation may write: if it throws, every write is rolled back; if it returns, each resource written holds one undo entry for the whole of it. -
shows(
AgentGuardTarget target) → bool -
The guard's verdict on
targetas a read, for reads that enumerate: an entry the guard would refuse is left out of their answer. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- callWrites → bool
-
Whether the tool call running now writes its targets. Outside any call,
true: the stricter answer.
no setter