Skip to main content
Agency Swarm is a multi-agent orchestration framework built around role-based agents and tool-calling. Vaultak plugs into two integration points it exposes natively.

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

Sign up at vaultak.com to get your API key (starts with 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, subclass BaseTool 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().

Combined Example

Use both approaches together for defence-in-depth: guardrails screen all messages, the mixin secures individual high-risk tools.

Stricter thresholds for sensitive agencies

For agencies with access to databases, payment systems, or external APIs, lower the threshold to block medium-risk actions:

Configuration reference

ParameterTypeDefaultDescription
api_keystrYour Vaultak API key — required
agent_namestr"agency-swarm-agent"Label shown in the Vaultak dashboard
RISK_THRESHOLDfloat7.0Score (0-10) at or above which actions are blocked

What gets monitored

EventVaultak action
Incoming message (input guardrail)Risk-scored; blocked via tripwire_triggered=True if score >= threshold
Policy checkValidated against your dashboard-configured rules
Tool call (VaultakMixin)Risk-scored; blocked via RuntimeError if score >= threshold
Tool output (VaultakMixin)Scanned for PII and masked before returning to the agent
Agent response (output guardrail)PII masked before the response reaches the user