AgentInvocation.withExecution constructor
AgentInvocation.withExecution({
- required AgentExecutionGrant grant,
- required String residualRiskShown,
- required AgentScope scope,
- int stepBudget = defaultStepBudget,
- Duration timeBudget = defaultTimeBudget,
An invocation with execution — an explicit, per-invocation user act.
residualRiskShown must be grant's statement, exactly: the affordance
that granted consent passes the text it showed.
Implementation
factory AgentInvocation.withExecution({
required AgentExecutionGrant grant,
required String residualRiskShown,
required AgentScope scope,
int stepBudget = defaultStepBudget,
Duration timeBudget = defaultTimeBudget,
}) {
if (residualRiskShown != grant.statement) {
throw ArgumentError.value(
residualRiskShown,
'residualRiskShown',
'execution is granted only against the residual-risk statement',
);
}
return AgentInvocation._(
invocationId: _newId(),
origin: AgentOrigin.localAgent,
allowExecution: true,
scope: scope,
stepBudget: stepBudget,
timeBudget: timeBudget,
);
}