Skip to content

API Reference parrot.bots.guardrails.events

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.bots.guardrails.events

View source

Guardrail telemetry lifecycle event (FEAT-396).

Extends the FEAT-176 LifecycleEvent taxonomy with a guardrails-scoped event, following the same additive pattern parrot.eval.events uses for the evaluation harness — a new feature-owned event class, not a modification to parrot.core.events.lifecycle itself.

Added post-review: the spec's acceptance criterion "Telemetry emits guardrail name/stage/action/duration/counts... via existing FEAT-176 observers" was previously unmet — GuardrailPipeline's on_telemetry callback (TASK-2025) was never actually supplied by the bot-wiring code (TASK-2026/2028/2029), so no GuardrailTelemetryEntry ever reached a real observer. AbstractBot._on_guardrail_telemetry (see bots/abstract.py) forwards each entry here.

Class GuardrailActionEvent

Emitted once per guardrail execution within a GuardrailPipeline.run().

Never carries content — only name/stage/action/duration, per spec §2 ("Uniform telemetry (name + action + duration + counts, never content) via FEAT-176 observers").

Parameter Type Default Description
guardrail_name str ''
stage str ''
action str ''
duration_ms float 0.0
agent_name str ''

Fields:

Field Type Default Description
guardrail_name str '' The executed guardrail's name.
stage str '' The GuardrailStage value ("input", "tool_output", "output", "output_stream").
action str '' The GuardrailAction value produced (or the effective verdict after error handling, e.g. "block" for a fail_closed exception).
duration_ms float 0.0 Wall-clock time spent in the guardrail's check().
agent_name str '' Name of the bot that ran the pipeline.

Alias LifecycleEvent

Re-exported from parrot.core.events.lifecycle.LifecycleEvent.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally