Approvals and Guardrails
OpenBox evaluates governed LangChain middleware boundaries and returns verdicts that the SDK enforces at runtime.
Verdicts
| Verdict | Meaning | Runtime effect |
|---|---|---|
ALLOW | Continue normally | Execution proceeds |
REQUIRE_APPROVAL | Human review required | The SDK waits for approval or raises if approval is rejected or expires |
BLOCK | Operation must not continue | Execution raises GovernanceBlockedError |
HALT | Agent run must stop | Execution raises GovernanceHaltError |
Enforcement Model
For model calls:
LLMStartedis evaluated before the model provider is called- Prompt-side guardrails may apply
- The model call executes
LLMCompletedis evaluated- Output-side guardrails may apply
- Approval may be required on either side
For tool calls:
ToolStartedis evaluated before the tool executes- Input-side guardrails may apply
- The tool executes
ToolCompletedis evaluated- Output-side guardrails may apply
- Approval may be required on either side
For agent runs:
WorkflowStartedcan stop execution earlySignalReceived(user_prompt)records the initiating promptWorkflowCompletedrecords final output context
Important Live-Run Behavior
In a standard OpenBox deployment, policy evaluates before guardrails for a given event.
Operational consequence:
- If policy returns a non-
ALLOWverdict such asREQUIRE_APPROVAL,BLOCK, orHALT, guardrails for that event may not run. - If a guardrail UI test passes but the live run shows no guardrail result, inspect the policy verdict first.
Guardrail Field Selection
Recommended fields:
| Event | Field to check | Example use |
|---|---|---|
LLMStarted | prompt | Prompt-side PII, jailbreak, or restricted-topic checks |
LLMCompleted | completion | Response-side safety and sensitive output checks |
ToolStarted | activity_input | Tool input restrictions before execution |
ToolCompleted | activity_output | Tool output restrictions after execution |
Important:
- Agent prompts are also emitted as
SignalReceived(user_prompt). - For live tool guardrails, match on
ToolStartedwhenever possible.
Approval Handling
When OpenBox returns REQUIRE_APPROVAL, the SDK uses the shared OpenBox
governance approval flow.
Typical behavior:
- OpenBox creates an approval request
- The request appears in the OpenBox dashboard
- A human reviewer approves, rejects, or lets the request expire
- The SDK continues only after approval is granted
Timeout or rejection raises a governance error.
In the standard LangChain middleware path, approval rejection or expiry raises
GovernanceHaltError. The lower-level ApprovalRejectedError and
ApprovalExpiredError classes are still exported for direct approval polling
integrations.
Output-Time Approval
Approval is not limited to the requested action. LLMCompleted and
ToolCompleted can also return REQUIRE_APPROVAL, which is useful when policy
needs to review actual output instead of just the requested operation.
Runtime Errors You Should Expect
| Error | Meaning |
|---|---|
GovernanceBlockedError | OpenBox returned a BLOCK verdict |
GovernanceHaltError | OpenBox returned a HALT verdict, or approval rejection/expiry halted execution |
GuardrailsValidationError | Guardrail validation failed |
ApprovalRejectedError | Lower-level direct approval polling received a rejection |
ApprovalExpiredError | Lower-level direct approval polling expired before resolution |
Production Recommendations
- Keep approval policy focused on business boundaries.
- Use
ToolStartedselectors for tool-input guardrails. - Use
LLMStartedandLLMCompletedfor prompt and response guardrails. - Test live guardrails only after confirming policy returns
ALLOWfor that event.