Input & Output Guardrails
Risk-score incoming messages and mask PII in agent responses using Agency Swarm’s native guardrail decorators.
BaseTool Mixin
Intercept individual tool calls before they execute by mixing Vaultak checks into any BaseTool subclass.
Install
vtk_).
Guardrail Approach
Agency Swarm’s@input_guardrail and @output_guardrail decorators let you intercept messages at the agency boundary without touching any tool code.
- Input guardrail — risk-scores each incoming message before the agent processes it; blocks if the score meets or exceeds your threshold.
- Output guardrail — masks PII in agent responses before they reach the user.
asyncio.to_thread() is required because Vaultak SDK calls are synchronous and guardrail functions are async. This keeps the event loop non-blocking.Tool-Level Approach
For per-tool risk scoring, subclassBaseTool through the VaultakMixin. The mixin intercepts run(), calls Vaultak before execution, and masks PII in string outputs afterward.
Inherit
VaultakMixin before BaseTool so Python’s MRO calls VaultakMixin.run() first, then chains to your tool’s run() via super().