Skip to main content

Function: runPostApprovalGuardrails()

runPostApprovalGuardrails(toolName, args, guardrailIds, callbacks?): Promise<GuardrailHitlOverrideResult>

Defined in: packages/agentos/src/api/agency.ts:1373

Runs post-approval guardrails against tool call arguments to catch destructive actions that slipped past the HITL handler.

This is the core safety net: even when auto-approve, LLM judge, or a human approves a tool call, the configured guardrails get a final say. If any guardrail returns action: 'block', the approval is overridden.

Parameters

toolName

string

The tool that was approved.

args

Record<string, unknown>

The arguments the tool would be called with.

guardrailIds

string[]

Ordered list of guardrail IDs to evaluate.

callbacks?

AgencyCallbacks

Optional event callback map for emitting override events.

Returns

Promise<GuardrailHitlOverrideResult>

A result indicating whether the guardrails passed.