Skip to content

GuardrailObserver

Hooks the pipeline calls as guardrails act, so the SDK can turn them into guardrail.* events.

Defined in: src/core/pipeline/GuardrailPipeline.ts:71

Hooks the pipeline calls as guardrails act, so the SDK can turn them into guardrail.* events.

Remarks

Every method is optional and invoked synchronously. Handlers must not throw.

Methods

onApplied()?

optional onApplied(application): void;

Defined in: src/core/pipeline/GuardrailPipeline.ts:73

A guardrail rewrote the text.

Parameters

ParameterType
applicationGuardrailApplication & { stage: GuardrailStage; }

Returns

void


onBlocked()?

optional onBlocked(application): void;

Defined in: src/core/pipeline/GuardrailPipeline.ts:75

A guardrail suppressed the text.

Parameters

ParameterType
applicationGuardrailApplication & { stage: GuardrailStage; }

Returns

void


onError()?

optional onError(info): void;

Defined in: src/core/pipeline/GuardrailPipeline.ts:77

A guardrail threw or timed out.

Parameters

ParameterType
info{ error: Error; guardrail: string; policy: "passthrough" | "block"; stage: GuardrailStage; }
info.errorError
info.guardrailstring
info.policy"passthrough" | "block"
info.stageGuardrailStage

Returns

void

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency