llm_gate()

Register an LLM-powered blocking gate.

Usage

Source

llm_gate(
    prompt,
    *,
    message,
    response_model=GateVerdict,
    verdict=lambda r: r.block,
    signals=None,
    when=None,
    only_if=(),
    skip_if=(),
    events=None,
    max_fires=None,
    tests=None,
    max_context=2000,
    specialty="review",
    model="small",
    agent=True,
    transcript=True
)

Defaults are tuned for the common case: agent=True and transcript=True so the gate has tool access and full transcript context. Pass agent=False, transcript=False for cheap, stateless yes/no checks.

Example

llm_gate(“Is the agent making excuses?”, … message=lambda r: f”Excuse detected: {r.reasoning}“, … signals=Signals([Signal(r”external.*service”, weight=2)], threshold=2))