GuardrailErrorEvent
Emitted when a guardrail throws or exceeds its timeout.
Defined in: src/core/events/types.ts:685
Emitted when a guardrail throws or exceeds its timeout.
Remarks
The policy field reports how the SDK handled it: 'passthrough' kept the text and skipped the guardrail, 'block' suppressed the text. Treat these events as an alert — a guardrail that fails silently is a guardrail that is not protecting anything.
Example
agent.on('guardrail.error', (event) => {
metrics.increment('guardrail.failure', { guardrail: event.guardrail });
});
See
GuardrailEvent for all guardrail event types
Extends
BaseEvent
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
error | Error | The error thrown, or a timeout error synthesized by the SDK. | - | src/core/events/types.ts:696 |
guardrail | string | Name of the guardrail that failed. | - | src/core/events/types.ts:690 |
metadata? | Record<string, unknown> | Optional metadata associated with the event. Remarks May contain provider-specific data or debugging information. | BaseEvent.metadata | src/core/events/types.ts:94 |
policy | "passthrough" | "block" | How the failure was handled, per the configured error policy. | - | src/core/events/types.ts:699 |
stage | "chunk" | "final" | Pipeline point at which it ran. | - | src/core/events/types.ts:693 |
timestamp | number | Unix timestamp (in milliseconds) when the event occurred. Remarks Useful for latency measurements and debugging the pipeline timing. | BaseEvent.timestamp | src/core/events/types.ts:86 |
type | "guardrail.error" | Discriminant for this event type. | - | src/core/events/types.ts:687 |