Skip to main content

agentbastion

A checkpoint between the AI agent your business ships and the world. Businesses now deploy chatbots, copilots, and agents wired to their data and tools — and almost nobody secures that new surface. This does.

Three guards, one product:

  USER / ATTACKER          FIREWALL                     AGENT (LLM + data/tools)
  input           -->  [1 inbound scan] --block-->
                  -->  ok                          -->  agent runs
  agent action    <--  [2 tool guard]  --block-->  <--  agent wants a tool
  reply           <--  [3 outbound redact]         <--  agent reply
  1. Inbound — block prompt injection / jailbreaks before the model sees them.
  2. Tool — stop the agent doing something dangerous (mass email, delete, refund, exfil). This is the differentiator — everyone scans prompts; few guard what the agent actually does.
  3. Outbound — redact PII and secrets from the reply.

Ships as a drop-in SDK: your data never leaves your box. A hosted gateway with dashboards and alerts is the paid tier later.

Install

pip install agentbastion            # core guards (offline, no model needed)
pip install "agentbastion[judge]"   # + Anthropic LLM judge for subtle injection

Quick start

from agentbastion import Firewall, guard, load_policy

firewall = Firewall()                                  # heuristics + PII redaction
firewall.tool_policy = load_policy("allowlist.yaml")   # gate tool calls

@guard(firewall)                    # inbound + outbound guards
def my_agent(user_input: str) -> str:
    ...                             # your agent; call firewall.check_tool() in its tool loop
    return reply

Full working agent on the raw Anthropic SDK (all three guards): examples/basic_agent.py.

Tool policy (allowlist.yaml)

default: deny
allow: [get_order_status, search_faq]
deny:  [issue_refund]        # money movement stays human-approved
rate_limits: { get_order_status: 5 }

Decision order: deny → allow → default → rate limit.

Optional LLM judge

import anthropic
firewall = Firewall.with_judge(anthropic.Anthropic())   # runs on claude-haiku-4-5

Heuristics are free and offline. The judge catches subtler attempts at real per-request cost/latency — turn it on for sensitive routes, off for high-volume low-risk ones. It fails open: a judge outage never takes your agent down.

Audit log

Every decision is appended to agentbastion.jsonl. Summarize it:

python -m agentbastion.events agentbastion.jsonl

What this is not

Defense in depth, not a silver bullet. No injection detector is perfect and no PII regex catches everything. Run this as one layer alongside least-privilege tool scoping, human approval on money movement, and real monitoring. Build like it will be attacked — because a security tool will be.

Known v0 ceilings (all have an upgrade path in the code):

  • Injection = hand-rolled regex signatures + optional LLM judge. Swap in Llama Guard / Rebuff / a fine-tune behind the same interface.
  • PII = regex for the leaks that cost money (SSN, credit card w/ Luhn, API keys, private keys, email). Swap in Microsoft Presidio for names/addresses/locale-aware NER.
  • Rate limits = in-memory per process. Move to Redis for multi-worker deployments.

Tests

pip install "agentbastion[dev]"
pytest -q

MIT.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentbastion-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentbastion-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file agentbastion-0.1.0.tar.gz.

File metadata

  • Download URL: agentbastion-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agentbastion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f03babd9ea78bc0438e4dafa27ed7d8ab10c7e834c12303cd726e6c80f7922e0
MD5 126feabb9dfc0406ed183b5245c7e126
BLAKE2b-256 e403d91a5097c7a4ec345eee101681ca9d86f24c1a04217759f8625426f008b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentbastion-0.1.0.tar.gz:

Publisher: publish.yml on Rinkia/agentbastion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentbastion-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentbastion-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agentbastion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66874051a307f5c8e01a40678b502856921e3675f734d6598d79f4d5b1ad2282
MD5 42fa3a73e6c58204eb79258368146b01
BLAKE2b-256 2720ff042d63a501c25ac81e9adc2e5117fbc78658c88b843ef73aa7e562e612

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentbastion-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Rinkia/agentbastion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page