I Built an Ultra-Fast (
Autonomous AI Agents powered by frameworks like LangChain, CrewAI, AutoGen, and OpenAI SDK are revolutionizing automation through Tool-Calling. However, giving an LLM unsupervised access to execute raw HTTP endpoints or
Autonomous AI Agents powered by frameworks like LangChain, CrewAI, AutoGen, and OpenAI SDK are revolutionizing automation through Tool-Calling.
However, giving an LLM unsupervised access to execute raw HTTP endpoints or database operations introduces severe security and privacy risks. An unguided AI agent could trigger destructive mutations (DELETE /transactions) or leak sensitive customer data (GET /customers) violating privacy laws (such as LGPD) and central bank cybersecurity resolutions (CMN 5.274 / BACEN 538/2025).
To solve this, I built and open-sourced Aegis Core 🛡️.
💡 What is Aegis Core?
Aegis Core is an open-source, ultra-low latency HTTP reverse proxy written in Go that sits between your AI Agents and your internal backend APIs.
It evaluates every incoming agent tool-call against $O(1)$ in-memory compliance policy rules, proactively blocking dangerous requests before they reach your backend, and recording immutable JSON audit logs.
flowchart LR
A[🤖 AI Agent / LLM Tool-Call] -->|Bearer Token + HTTP Req| B[🛡️ Aegis Core Proxy]
B -->|Check Policy O1| C{Compliance Valid?}
C -->|YES - ALLOWED| D[🟢 Internal Backend API]
C -->|NO - BLOCKED| E[🔴 403 Forbidden Response]
B -->|Immutable JSON Log| F[📜 audit_bacen.log]
⚡ Engineering & Architecture Highlights
1. Ultra-Low Overhead (~0.08ms per request)
Benchmarked using Go's native testing package (go test -bench), Aegis adds under 0.1ms latency overhead per request:
BenchmarkAegisProxy-10 14493 81553 ns/op 40859 B/op 95 allocs/op
2. Thread-Safe Audit Logging
The audit logger uses a sync.Mutex lock to guarantee atomic JSON line writes under heavy concurrent HTTP request loads without log corruption or race conditions.
3. Graceful Shutdown & Health Endpoints
The server handles OS interrupt signals (SIGINT, SIGTERM) cleanly via signal.Notify and context.WithTimeout, closing active connections and flushing log files safely.
4. Embedded Visual Web Console
It serves an embedded glassmorphism Web Console at http://localhost:8080/_aegis/dashboard for live inspection, policy card viewing, and interactive tool-call simulations out of the box.
🚀 Quickstart: Running the 5-Second Interactive Demo
You can test Aegis blocking non-compliant requests in seconds:
git clone https://github.com/pedrodawybida/aegis-core.git
cd aegis-core
make demo
The demo script:
- Spawns a mock backend banking API on port 9000.
- Builds and starts Aegis Core on port 8080.
- Tests 4 compliance scenarios (Allowed POST, Blocked LGPD GET, Blocked BACEN DELETE, Blocked CFM GET).
- Displays the generated immutable JSON audit log in real time.
🛠️ Zero-Code Integration Example
Developers don't need to rewrite their agent logic. Simply update your OpenAI SDK or HTTP client's base_url to point to Aegis:
import openai
client = openai.OpenAI(
base_url="http://aegis-proxy.internal:8080", # Point to Aegis Proxy
default_headers={"Authorization": "Bearer ia-fintech-support"}
)
🔗 Try it out & Contribute!
Aegis Core is 100% Open-Source under the MIT License.
⭐ GitHub Repository: github.com/pedrodawybida/aegis-core
I'd love to hear your feedback on Go concurrency, performance benchmarks, and security rules! Feel free to star the repo or open an issue! 🚀
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.