Skip to main content

Argus — a security layer for OpenAI-compatible LLM traffic

PyPI version PyPI downloads DOI

An OpenAI-compatible gateway that enforces security policy before a model sees your data. Argus ships native OpenAI and Anthropic provider adapters, and its generic adapter can sit in front of OpenAI-shaped endpoints such as vLLM and Ollama. Bedrock, Gemini, and Mistral adapters are roadmap items, not part of the current release.

Every request passes through the policy engine on the way in and on the way out. Cost intelligence (tiered routing, graceful budgets, per-task attribution) rides along via tokenecon, but security is the product.

Argus Chat — the demo

Argus Chat demo

One live session (Nov 9, 2026) through Argus Chat, the integrated showcase front-end: a normal summary with its cost receipt, a PII-bearing request answered with the redactions already in place, an AWS key blocked before any model saw it, and a prompt injection flagged on the receipt. Argus's own record for the session: 3 calls, 605 tokens, $0.000182. The local model was Llama 3.2 1B Instruct behind Ollama on a small CPU VM, mapped to tokenecon's small tier — so the dollars are shadow prices for comparability, not invoices. Full screenshots, the task record, the audit excerpt, the reproduction script, and the honest disclosures (including how the two earlier models behaved differently) are in demo/.

Works with

  • tokenecon — the cost engine inside Argus: tiered routing, graceful budgets, per-task receipts. Argus Chat is where it becomes visible — every answer carries its receipt.
  • mcplens — runtime vetting for MCP tool servers, so tools are graded before they connect to anything behind this gateway. The TicketDesk server built for the Argus Chat demo grades A (100/100); feeding the grade into Argus's allow/deny path is the next build step.
  • Argus Lens — the same don't-send-it-unguarded stance at the browser surface: Lens checks prompts before they are sent; Argus checks them at the gateway.
  • agent-cost-mcp-server — run costs exposed to agents over MCP, from the same tokenecon accounting.
  • PersistAIBench and Argus-Bench — the benchmarks that score what flows through: persistence failures over long runs, and 264 frozen screening cases for the gateway layer itself.

The connected set — one thread through all of it: what an agent did, what it cost, and whether it should have been allowed. Argus · tokenecon · mcplens · agent-cost-mcp-server · Argus Lens · PersistAIBench · Argus-Bench

The security layer

request -> auth -> INPUT policy -> budget -> route -> model
                                              -> OUTPUT policy -> audit -> response

Pluggable detectors (each scans, the policy decides):

Detector Catches Default action
Secrets AWS keys, private keys, GitHub/OpenAI tokens, password = ... block — never reaches a model
PII emails, phones, SSNs, credit cards, IPs redact — [REDACTED:EMAIL], request continues
Prompt injection "ignore previous instructions", role overrides, system-prompt probes, known jailbreaks flag — allowed but marked (one flag away from block)
Blocklist your own regexes block

Policy engine: per-direction rules (in / out / both) with four actions — allow, redact, block, flag. Add an ML-based detector later by subclassing Detector; no other code changes.

Customizable without code: write policy.yaml with named profiles (strict, standard, permissive, or your own), point the gateway at it with AIGW_POLICY_FILE, and assign a profile per virtual key — one team's keys block injections while another's only flag them. GET /admin/profiles lists what's loaded.

Audit log: every decision recorded — timestamp, key, task, detector, and action. Redacted PII is recorded in its redacted form; blocked events from the secrets detector store [REDACTED:SECRET] instead of payload text. GET /admin/audit for compliance review.

Quickstart

This five-minute demo uses the built-in mock models, so it needs no provider API key.

Install Argus, set a master (admin) key, and start the gateway:

pip install argus-gateway
export AIGW_MASTER_KEY="sk-admin-secret"
argus

argus serves on 127.0.0.1:4000 with mock-small and mock-large. Leave it running and use a second terminal for the remaining commands.

In the second terminal, create a virtual key. The response contains the raw key only once, so the commands below print it and save it in a shell variable for the next calls:

export AIGW_MASTER_KEY="sk-admin-secret"
KEY_RESPONSE=$(curl -s -X POST http://127.0.0.1:4000/admin/keys \
  -H "Content-Type: application/json" \
  -H "X-Admin-Key: $AIGW_MASTER_KEY" \
  -d '{"name":"demo","budget_usd":10}')
printf '%s\n' "$KEY_RESPONSE"
export AIGW_VIRTUAL_KEY=$(printf '%s' "$KEY_RESPONSE" | python3 -c 'import json, sys; print(json.load(sys.stdin)["key"])')

Send text containing a private-key header. Argus blocks it before the mock model is called:

curl -i -X POST http://127.0.0.1:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AIGW_VIRTUAL_KEY" \
  -d '{"model":"mock-small","messages":[{"role":"user","content":"Use this key: -----BEGIN RSA PRIVATE KEY-----"}]}'

The response is HTTP 400:

{"detail":"blocked by security policy: secrets:PRIVATE_KEY"}

Now send an email address:

curl -s -X POST http://127.0.0.1:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AIGW_VIRTUAL_KEY" \
  -d '{"model":"mock-small","messages":[{"role":"user","content":"Email me at jane@example.com"}]}'

The call returns HTTP 200. Its gateway object is:

"gateway": {
  "provider": "mock", "tier": "small", "difficulty": 0.0,
  "cost_usd": 3e-06, "degraded": false,
  "security": {"redactions": ["pii:EMAIL"], "flags": []}
}

Finally, inspect the audit log:

curl -s "http://127.0.0.1:4000/admin/audit?limit=10" \
  -H "X-Admin-Key: $AIGW_MASTER_KEY"

Events are returned newest first. The email event's snippet is Email me at [REDACTED:EMAIL]; the blocked private-key event has category PRIVATE_KEY, action block, and snippet [REDACTED:SECRET].

The packaged argus command is this mock-only demo. Real backends are configured in code with the native OpenAI and Anthropic providers or with GenericProvider for an OpenAI-shaped endpoint.

Also inside: cost intelligence

  • Tiered routing — requests scored for difficulty, cheapest capable tier wins
  • Graceful budgets — over budget? Falls back to the cheapest tier and flags degraded: true instead of failing (hard-stop mode available)
  • Per-task attribution — X-Task-Id groups an agentic run's turns into one costed task: GET /admin/tasks/{id}

Admin API (X-Admin-Key required)

  • POST /admin/keys — issue virtual keys with budgets (degrade/hard, daily/monthly)
  • GET /admin/spend, GET /admin/keys/{id}/spend — spend tracking
  • GET /admin/tasks/{task_id} — per-task cost breakdown
  • GET /admin/audit?limit=&key_id= — security decisions

Tunable detection profiles

Detection is a dial, not a fixed setting. Findings carry a confidence, and a profile decides how sure the gateway must be before it acts — and whether a local LLM judge reviews what the patterns miss:

  • auto (default) — adaptive: high-confidence patterns block instantly; everything else escalates to the judge, and blocking requires a high combined pattern+judge confidence — borderline cases flag and pass, so real work is not blocked.
  • strict — catch everything, accept false alarms: low confidence thresholds, injections blocked, judge always on with a low block bar.
  • balanced — patterns flag at medium confidence and up; the judge runs only on pattern misses and blocks only when confident.
  • quiet — minimise false alarms: only high-confidence pattern findings act, injections are flagged never blocked, judge off.
  • standard — the legacy action-only profile, unchanged.

The shipped policy.yaml carries all four profiles; assign one per key with policy_profile. Judge settings (endpoint, model, bars) are per-profile YAML, and the judge is any local OpenAI-compatible endpoint. Measured on the frozen Argus-Bench corpus (264 cases; judge = local Qwen2.5-0.5B, Nov 2026):

Profile Attacks detected Attacks blocked Benign flagged Benign blocked
patterns only (v1 baseline) 15/204 (7.4%) — 7/60 (11.7%) —
quiet 10/204 (4.9%) 0 1/60 (1.7%) 0
auto 155/204 (76.0%) 147 34/60 (56.7%) 28
balanced 155/204 (76.0%) 140 34/60 (56.7%) 27
strict 155/204 (76.0%) 155 34/60 (56.7%) 34

The dial works — quiet↔strict spans the range — and the measurement also shows the current limit: the 0.5B judge's self-reported confidence barely discriminates (it answers 0.9 or 1.0 on both verdicts), so auto, balanced, and strict detect identically and differ only in enforcement. Auto's combined-confidence design cannot show its advantage until the judge's confidence separates; a judge whose confidence does is the next lever.

Roadmap

Streaming (SSE), Bedrock/Gemini/Mistral adapters, semantic caching, OTEL/Prometheus export, admin UI, SSO/RBAC, ML-based injection detector.

Cite

If you use this software in your work, please cite it:

@software{pandey_argus_2026,
  author = {Pandey, Karmendra},
  title = {Argus},
  version = {0.2.0},
  doi = {10.5281/zenodo.23427027},
  url = {https://github.com/karmendra8386/argus},
  date = {2026-11-11}
}

Companion preprint

K. Pandey, "Your AI Agent Is Now an IAM Principal: Identity Architecture for Autonomous Agents," Zenodo, DOI 10.5281/zenodo.23199763, 2026.

@misc{pandey2026iamprincipal,
  author       = {Pandey, Karmendra},
  title        = {Your AI Agent Is Now an IAM Principal: Identity
                  Architecture for Autonomous Agents},
  year         = {2026},
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.23199763},
  url          = {https://doi.org/10.5281/zenodo.23199763}
}

A CITATION.cff is included for automated citation tooling. Write-up: Every LLM Call Should Pass Through a Security Layer — Here's the Pattern — AWS Builder Center

License

MIT — Karmendra Pandey.

Metadata

Release files for argus-gateway 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argus-gateway 0.2.0
File Size Uploaded Provenance Actions
argus_gateway-0.2.0.tar.gz 31.0 kB With provenance Details for argus_gateway-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for argus-gateway 0.2.0
File Interpreter ABI Platform Actions
argus_gateway-0.2.0-py3-none-any.whl Python 3 none any Details for argus_gateway-0.2.0-py3-none-any.whl

Total release size: 63.4 kB

Release files / argus_gateway-0.2.0.tar.gz

Download URL argus_gateway-0.2.0.tar.gz
Size 31.0 kB
Tags Source
SHA-256 checksum
How to use checksums
df1493bb31fbef9f26cabef74ee92dacda1da3af3ca67ac62eb606b68250ce04
BLAKE2b-256 checksum
How to use checksums
6b579ec046655729b9681096b4a449226763df3a823d6f1b30f4fac86883d739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / argus_gateway-0.2.0-py3-none-any.whl

Download URL argus_gateway-0.2.0-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e421d737afb218c0d84c34aa2a161d5c1f9e9792e3d88ec66be568592ec0e2cf
BLAKE2b-256 checksum
How to use checksums
bc5dbcbe39222d7cba49e531626c6e600f85c76d2a4d7fdb16e932184e0f9e3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for argus-gateway 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for argus_gateway-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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