Skip to main content

Function: withModerationPosture()

withModerationPosture(svc, options?): IGuardrailService

Defined in: packages/agentos/src/safety/guardrails/requiredGuardrails.ts:131

The guard as a moderation entry point runs it: failClosed true unless its config says false; a deadline; an answer with no recognised action turned into a BLOCK (when closed) or dropped (when open); its id stamped into metadata.guardrailId. The original service is not changed.

The wrapper races no deadline and catches nothing itself: the dispatcher reads the wrapped config, so one place applies the deadline, builds the synthetic BLOCK of a guard that throws or runs late, and writes guardrail.failed.

Parameters​

svc​

IGuardrailService

The guard.

options?​

ModerationPostureOptions = {}

The deadline for a guard whose config names none.

Returns​

IGuardrailService

A new service over the same guard.