plyra-guard emits an audit event for every decision — allowed and blocked.
Events go to one or more exporters.
plyra-guard emits an audit event for every decision — allowed and blocked.
Events go to one or more exporters.
StdoutExporter is always enabled by default. It writes JSON lines to
stdout on every action. In production, disable it to avoid log noise by
setting observability.exporters: [] in your YAML config.
StdoutExporter (default)
Writes audit entries as JSON lines to stdout. Enabled by default when
"stdout" is in the observability.exporters list.
from plyra_guard import StdoutExporter
exporter = StdoutExporter(pretty=True) # pretty-prints JSON
guard.add_exporter(exporter)
To disable in your config:
observability:
exporters: []
Constructor
| Parameter | Type | Default | Description |
|---|
stream | object | None | sys.stdout | Output stream |
pretty | bool | False | Pretty-print JSON output |
OTelExporter
Exports audit entries as OpenTelemetry spans.
pip install "plyra-guard[otel]"
from plyra_guard.observability.exporters import OTelExporter
guard.add_exporter(OTelExporter(service_name="my-agent"))
Constructor
| Parameter | Type | Default | Description |
|---|
service_name | str | "plyra_guard" | OTel service name for spans |
DatadogExporter
Exports audit entries as Datadog spans via ddtrace.
pip install "plyra-guard[datadog]"
from plyra_guard.observability.exporters import DatadogExporter
guard.add_exporter(DatadogExporter(service_name="my-agent"))
Constructor
| Parameter | Type | Default | Description |
|---|
service_name | str | "plyra_guard" | Datadog service name for spans |
WebhookExporter
POSTs audit entries as JSON to an arbitrary URL. Useful for Slack, PagerDuty,
or custom dashboards.
from plyra_guard.observability.exporters import WebhookExporter
guard.add_exporter(WebhookExporter(
url="https://hooks.slack.com/services/...",
headers={"Authorization": "Bearer token"},
timeout=10,
))
Constructor
| Parameter | Type | Default | Description |
|---|
url | str | — | Webhook URL to POST to |
headers | dict[str, str] | None | None | Extra HTTP headers |
timeout | int | 10 | Request timeout in seconds |
Combining exporters
from plyra_guard.observability.exporters import (
OTelExporter,
DatadogExporter,
WebhookExporter,
)
guard.add_exporter(OTelExporter())
guard.add_exporter(DatadogExporter())
guard.add_exporter(WebhookExporter(url="https://..."))
Snapshot database
All decisions are written to ~/.plyra/snapshots.db (SQLite).
Change the path via environment variable:
export PLYRA_SNAPSHOT_PATH=/your/path/snapshots.db
Or in your YAML config:
rollback:
snapshot_dir: /your/path/