When a guardrail triggers, the task pauses and waits for your response before continuing.
Prefer secrets for login credentials. If you know which sites the agent will authenticate with, use the secrets parameter to provide credentials upfront. This avoids guardrail interruptions entirely, so the task runs without pausing. Secrets are never stored — they are discarded when the session ends.
Once a guardrail triggers, respond with the requested information or guidance. The newState: "resume" parameter tells the agent to continue execution from the exact point where the guardrail paused—it doesn’t restart the task.
Polling and WebSocket both assume something on your side is watching the session when a guardrail triggers. For unattended workloads — scheduled triggers, long-running CI jobs, MCP tasks kicked off from another tool — that isn’t always the case. As a fallback, a guardrail can be delivered to a chat user connected to the session’s environment, and their reply is forwarded back to the session.
When a session raises a guardrail, the platform first checks whether you’re actively handling it (polling responses or a live WebSocket subscription on the session). If you are, the prompt reaches you the usual way and nothing else happens.If no one is actively watching, the platform looks for a chat user (Telegram, WhatsApp, Slack, Discord, or Teams) connected to the same environment. If one is available, the guardrail prompt is sent to them in chat. Their reply is forwarded to the session exactly like a regular guardrail response — resume to continue or stop to cancel.Whoever answers first wins. If your API caller and a chat user both respond at the same time, only the first reply reaches the session.
Chat reach-out is controlled per session by the reachOutMode parameter. It takes one of three values, and defaults to "guardrail_only":
Value
Behavior
"off"
No proactive chat messages. Guardrails and results stay on the API/WebSocket channel only.
"guardrail_only"
Default. The bot pings the chat user only when the session hits a guardrail (CAPTCHA, 2FA, verification, login, etc.).
"full"
The bot pings on guardrails and also delivers the task result to chat when the task completes.
To turn chat routing off for a specific session, pass "reachOutMode": "off" at session creation:
{ "environmentId": "683a1f2e4b0c1d2e3f4a5b6c", "reachOutMode": "off", "mode": "default", "task": { "prompt": "Export the monthly financial report and download the PDF" }}
reachOutMode is set at session creation and applies for the lifetime of the session. There is no way to change it later — start a new session if you need different behavior.
Sensitive sessions. Anything involving private credentials, financial data, or personal information you don’t want surfaced through chat.
Shared environments. When multiple people use the same environment but only your code should handle guardrails for this session.
Deterministic flows. Automations that must respond programmatically — turning chat routing off ensures the prompt always waits for your API call instead of being answered by someone else first.
Use "full" for unattended automations where a human on chat should also receive the task result — for example, a scheduled run kicked off via MCP or REST with no live client polling. When the session completes, the chat user is sent the task result in addition to (not instead of) the normal API/webhook delivery. The chat fan-out only fires when the caller is offline (no live WebSocket subscriber on the session).
If you’d rather avoid guardrails entirely for known auth flows, provide credentials upfront with secrets instead. Secrets are never stored and are scoped to the session.
{ "type": "guardrail_trigger", "data": { "type": "human_input_needed", "value": "I found 5 products matching 'wireless keyboard'. Which one should I select?" }}
Response:
socket.emit("message", { actionType: "guardrail", prompt: "Select the first one with the highest rating", newState: "resume"});
{ "type": "guardrail_trigger", "data": { "type": "human_input_needed", "value": "I found content that may be sensitive. Please verify before proceeding." }}