API Reference agentsea_guardrails v#0.1.0
Copy MarkdownModules
A check applied to text entering or leaving an agent. Each guardrail either
passes (:ok), rewrites the content ({:transform, new} — e.g. redaction), or
blocks it ({:block, reason}). AgentSea.Guardrails chains them.
Blocks content containing any banned :terms (case-insensitive substrings) —
handy for prompt-injection phrases or disallowed topics.
An LLM-as-moderator guardrail: asks a model whether the content violates a
policy and blocks it if so. Runs over any AgentSea.Provider (so it can go
through the gateway).
Blocks content longer than :max characters.
Redacts personally-identifiable information by rewriting the content (a
{:transform, _} outcome). Redacts emails, US SSNs, and phone numbers by
default; configure with :types (any of :email, :ssn, :phone).
Run a pipeline of AgentSea.Guardrails over text. Apply it to user input
before AgentSea.Agent.run/3 and/or to the agent's output before returning