What are Guardrails?
Guardrails are WebRun’s safety mechanism for human-in-the-loop control. When the AI agent encounters a situation requiring human judgment or sensitive information, it pauses the task and triggers a guardrail. This ensures the agent never:- Submits credentials without explicit permission
- Makes purchases or financial transactions autonomously
- Proceeds when instructions are ambiguous
- Bypasses security challenges like CAPTCHAs
When Guardrails Trigger
| Trigger Type | Example Scenario | Agent Response |
|---|---|---|
| Credentials Needed | Login form encountered | ”I need login credentials to proceed” |
| Purchase Confirmation | Checkout page reached | ”Do you want me to complete this purchase?” |
| CAPTCHA Detected | Security challenge appears | ”A CAPTCHA is blocking me. Please solve it.” |
| Ambiguous Instruction | Multiple valid interpretations | ”Which item should I click? There are several options.” |
| Security Warning | SSL error or warning page | ”I encountered a security warning. Should I proceed?” |
Guardrail Flow
When a guardrail is triggered, the workflow pauses and waits for human input:Detection Methods
REST API (Polling):Guardrail Response Format
Request from Agent
Response to Agent
Provide the requested information and resume the task: REST:Common Guardrail Types
1. Credentials Request
Trigger: Login form detected Agent Message: “I need login credentials to proceed” Response: Provide username and password Example:2. Purchase Confirmation
Trigger: Checkout or payment page reached Agent Message: “Do you want me to complete this purchase? The total is $49.99” Response: Confirm or deny Example:3. Ambiguous Choice
Trigger: Multiple valid options exist Agent Message: “Which product should I select? I see 3 options with similar names” Response: Clarify the choice Example:4. CAPTCHA or Security Challenge
Trigger: CAPTCHA appears Agent Message: “A CAPTCHA is blocking me. Please solve it.” Response: Either solve it manually or instruct to skip Example:Design Philosophy
WebRun’s guardrails are designed around these principles:1. Ask, Don’t Assume
When in doubt, the agent asks for clarification rather than making assumptions.2. Sensitive Actions Require Confirmation
Financial transactions, account changes, and data submission always trigger guardrails.3. Credentials Never Stored
WebRun doesn’t store credentials. You provide them on-demand when needed, or upfront using secrets.4. Human Remains in Control
You can intervene at any point, even if a guardrail hasn’t triggered.Handling Guardrails in Code
Basic Pattern (REST)
Advanced Pattern (WebSocket)
Automated Guardrail Handling
For common scenarios, you can build automated guardrail handlers:Avoiding Guardrails with Secrets
If you know the credentials the agent will need ahead of time, you can provide them upfront using thesecrets parameter. This lets the agent authenticate automatically without triggering a guardrail or pausing the task.