Running large language model agents in the wild brings new risks. An agent can drift, repeat harmful output, or consume unexpected resources. The numbat project from Perplexity AI offers a lightweight way to add observability and safety checks around any LLM‑driven workflow.
numbat works as a thin wrapper. It intercepts prompts and responses, logs them to a configurable store, and runs a set of validators before the result leaves the system. The validators include profanity filters, policy checks, token‑count limits, and custom Python functions. Because the wrapper is language‑agnostic, you can drop it into a Python script, a FastAPI endpoint, or a serverless function with only a few lines of code.
Masterphub.io lists a ready‑made skill that bundles numbat with a simple monitoring dashboard. Users can see request latency, error rates, and policy violation counts in real time. The dashboard also lets you pause a misbehaving agent without redeploying code.
The repo ships with example configurations. One file shows how to route logs to a local SQLite database, another demonstrates sending alerts to Slack when a violation spikes. The code is open source, so you can replace the storage backend with Elasticsearch, DynamoDB, or any system that fits your stack.
Security is baked in. All logs are signed with a HMAC key, preventing tampering. The wrapper can be set to redact sensitive fields before writing them to storage, helping you stay compliant with data‑privacy rules.
Because numbat is small (under 2,000 lines) it adds minimal latency. Benchmarks in the repo show an average overhead of 15 ms per request, which is acceptable for most production APIs.
For teams that already use LLM agents, adding numbat is a cheap way to gain visibility and enforce guardrails. It turns a black‑box deployment into a monitored service you can trust.
We turned this idea into a ready-to-use skill on Masterphub: "numbat‑enabled agent guardrails".