Skip to main content

Runtime security firewall for LangChain agents — intercepts tool calls, enforces YAML policy, logs to SQLite.

Project description

agentguard-runtime

Runtime security firewall for LangChain agents. Intercepts every tool call, checks it against a YAML policy, blocks disallowed calls, and logs everything to SQLite.

Install

pip install agentguard-runtime

Quick start

1. Write a policy file (policy.yml):

agent: pr-summarizer
rules:
  - tool: GitHubTool
    allow: [read]
    block: [admin, write]
  - tool: SlackTool
    allow: [write]
  - tool: "*"
    block: [exec, delete]

2. Add one line to your agent:

from agentguard_runtime import AgentFirewall

agent = initialize_agent(
    tools=[GitHubTool, SlackTool, ShellTool()],
    llm=llm,
    callbacks=[AgentFirewall(policy="policy.yml")]
)

If ShellTool tries to call exec, the agent gets a PolicyViolation and the event is logged.

CLI

# Show last 20 audit events
agentguard-runtime logs

# Start dashboard API on port 7070
agentguard-runtime dashboard

Dashboard endpoints

Endpoint Description
GET /events Recent audit events (filterable by ?decision=block&agent=x)
GET /summary Allowed vs blocked counts per tool today

Policy rules

  • allow list: only these actions are permitted on this tool
  • block list: these actions are always rejected
  • "*" tool: catch-all wildcard for unmatched tools
  • Default: if no rule matches, the call is blocked

Audit log

Events are stored at ~/.agentguard/audit.db (SQLite).

id | timestamp | agent | tool | action | input_preview | decision | reason

Dev setup

git clone <repo>
cd agentguard2
pip install -e ".[dev]"
pytest

License

MIT

Project details


Download files

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

Source Distribution

agentguard_runtime-0.1.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

agentguard_runtime-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentguard_runtime-0.1.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for agentguard_runtime-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6e82a149767a570c6d91ecd5c8618ee20a59d0d9a8c4c25c21b902e9e269edde
MD5 f0a5f73a7f1c5c05f49c546372fda401
BLAKE2b-256 bf6d82662db658abe53fa57ab49a4aeaed3d9671cd609697eec791220faab5dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agentguard_runtime-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2973e57475c5ffcda91ae794f00a72955c1148e9ed980d9259941c5aa73ff8ab
MD5 ac556c0d7f5435d0442a48a60ac0869e
BLAKE2b-256 ce8a3e8521f6c4ed7a52db683d2467d8c4dea07771019a0f127d96184717d776

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page