A developer-first, high-performance, deterministic reverse proxy middleware for AI agent tool execution
Project description
Argala
Argala is a developer-first, high-performance, deterministic reverse proxy middleware that sits inline with an agent's tool-execution loop. It strips safety away from the unstable LLM context layer and moves it into an un-bypassable, compiled execution boundary.
Overview
When developers give an LLM agent live tools (such as database connections, payment gateways, or shell access), they rely on system prompts to keep it safe (e.g., "You are a safe assistant, never delete tables"). However, system prompts are probabilistic suggestions, not deterministic rules. AI agents encounter execution errors, try to resolve them autonomously, hallucinate, and frequently bypass their own safety logic to be "helpful."
Argala solves this by intercepting tool calls before they reach the execution layer and evaluating them against a deterministic security policy.
Architecture
APPLICATION LAYER (Python: CrewAI / LangChain Core)
- Single line initialization: protect_tools()
│
(Zero-copy memory bridge via PyO3)
▼
PYO3 BINDING LAYER
│
▼
RUST RUNTIME ENGINE
- High-throughput pattern matching & string analysis
- Policy evaluation against local policy configuration
Installation
pip install argala-guard
Usage
from argala import ArgalaEngine, protect_tools
# Define your tools
def execute_sql_query(query_string: str):
return f"Executed: {query_string}"
# Define security policy
policy = {
"allowed_methods": ["execute_sql_query"],
"denied_patterns": ["DROP", "DELETE", "TRUNCATE"]
}
# Protect your tools
protected_tools = protect_tools([execute_sql_query], policy)
# Use protected tools
# protected_tools[0]("SELECT * FROM users") # OK
# protected_tools[0]("DROP TABLE users") # Blocked
# Or build the engine directly from TOML policy file
engine = ArgalaEngine.from_policy_file("argala_policy.toml")
# engine.inspect_payload("execute_sql_query", ("SELECT 1",)) # True
Configuration
The security policy can be defined:
- directly in a Python dictionary with:
allowed_methods: List of allowed method namesdenied_patterns: List of patterns to block (case-insensitive substring matching)- or in
argala_policy.toml(sample provided in this repository)
Development
To develop locally:
- Install Rust and Python development tools
- Install maturin:
pip install maturin - Build in development mode:
maturin develop - Run tests:
pytest test_argala_blocking.py
Troubleshooting Python 3.13 / PyO3 version mismatch
If maturin develop reports pyo3-ffi v0.20.3 and says Python 3.13 is newer than supported:
- ensure
Cargo.tomlusespyo3 = "0.22.6"or newer, - and refresh your lock/dependency resolution:
cargo update -p pyo3 -p pyo3-ffi -p pyo3-build-config- then rerun
maturin develop.
License
Apache License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file argala-0.0.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: argala-0.0.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 882.5 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32765687dce5bfc32b9d527aa436ec94ec41c0e354ddb071965686efadfca1b5
|
|
| MD5 |
c9667fd0528a8de0609f7c6a18955fc9
|
|
| BLAKE2b-256 |
15e859aba06b59c706c166857a459ed7adce8c9ce43c42a746da8d42afb637ca
|
File details
Details for the file argala-0.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: argala-0.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7960bd9d3fc0431e87cfa22f5082ef93c7a4eb23d893fc00284e354f3427bd2d
|
|
| MD5 |
752fa20e67830eb65af1b79503c3a4e5
|
|
| BLAKE2b-256 |
e493a99094a87099754f5085c4b4b8cb3839f8a4585e3e8d82e7b17998641714
|
File details
Details for the file argala-0.0.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: argala-0.0.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 977.1 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c77d646b1336d430c5b8c5ad54811af3727191cc9f819bf748179aac58ebe29e
|
|
| MD5 |
c49eb75e6487c1904ba161fffcca6cb1
|
|
| BLAKE2b-256 |
2ef35fdaedfd2f0e390fc108e8091c7ac39285f598b42facfa0b91c5e5a8709d
|
File details
Details for the file argala-0.0.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: argala-0.0.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 882.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e4d430e6b7a5654c1542b842b8ee4cf8b6eb8e29e7b843aee1068bb126e5c1f
|
|
| MD5 |
04bf113794cce4eed85ecdf7ec60e236
|
|
| BLAKE2b-256 |
5cda23b72dd43ce2551ec57eb57c29446868c3c90b8dd896e83eee0d0eceda3c
|
File details
Details for the file argala-0.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: argala-0.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f9aed98b738d0ccb494e28d1ea56aa773f80023a5b0f200800e627c1b99ddc7
|
|
| MD5 |
1ab7ac198f14398b2454779f83f64341
|
|
| BLAKE2b-256 |
09cd2c79079c4a8162d7659ae9af10701a2b1c3eea879d7107c638e00abacf3c
|
File details
Details for the file argala-0.0.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: argala-0.0.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 977.7 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be939fb238c2ca3ab41a7e615b0bf59ea007821fd37f33412d0b28daf9acba37
|
|
| MD5 |
d528610d0f69bc5787add1b9687a709e
|
|
| BLAKE2b-256 |
12366d67d1ddc9fa4a7dd3d4e4834f579925b630afe32e099dd9cdcc81519f86
|
File details
Details for the file argala-0.0.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: argala-0.0.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 882.9 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22bdf08cacd2faff8467bfe6332c099142a4a09f31922b1b679fbbe64e892fe1
|
|
| MD5 |
02e8af91905d1ca8c4dc1489d4ba4156
|
|
| BLAKE2b-256 |
5047a3430f3e8b84c0b03cf1bac66a1f3d3f1d307fb43217cd3ab0a1e1730fb6
|
File details
Details for the file argala-0.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: argala-0.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12ed5f9d239b39a002d7e0dbdc32c58ff929db1052d7078c7caf40dbc6df507b
|
|
| MD5 |
dd09bbb4d3659617456db3e2754673b1
|
|
| BLAKE2b-256 |
fdf3a0f9895ef3a8955b3eafa93cb7e629f37f1ad7ab8b7c0451dc89cdbec200
|
File details
Details for the file argala-0.0.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: argala-0.0.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 977.7 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6412ec430458a50f57acc60a50f070c852433434c61edcec880479527e30686
|
|
| MD5 |
bbbaf749082e3d25893eca27a97c56e1
|
|
| BLAKE2b-256 |
b29cc8c25688f61a7caee172f4d315cee0c7bc6c6a82d3bfc2377b7734315250
|