Skip to main content

createRunApprovals

@forge/monorepo


@forge/monorepo / backend/src / createRunApprovals

Function: createRunApprovals()

createRunApprovals(deps): object

Defined in: backend/src/hitl/approved-execution.ts:99

Parameters

deps

RunApprovalDeps

Returns

resume()

resume(context, runId): Promise<ApprovalResumeOutcome>

Act on a decision, once. Called by a resumed run before it gives the model another turn.

The claim comes first — before the decision is even read — because it is the only step that can fail exclusively. A denial and an expiry are claimed too: an unclaimed one would be found again on the next resumption, and the run would spin on a decision it has already honoured.

The tool and the input come off the stored approval and nowhere else. That is the whole guarantee: a model-regenerated call after approval means the human approved content that is not what runs.

Parameters

context

ExecutionContext

runId

RunId

Returns

Promise<ApprovalResumeOutcome>

runTool()

runTool(context, runId, call): Promise<GatedCallOutcome>

Run a tool on behalf of the model, raising a durable approval if the gate refuses it.

The order matters. Arguments are resolved and normalized before the call, so that the key is a property of the call rather than of the model's capitalization, and so that an approval — if one is needed — stores what will actually run. Invalid input is refused here rather than turned into an approval: asking a person to authorize a call that cannot succeed teaches them their approval is theatre.

Parameters

context

ExecutionContext

runId

RunId

call
input

unknown

name

string

Returns

Promise<GatedCallOutcome>