DEV Community

Cover image for I built an "Immune System" for AI Agents using Textual TUI & FastAPI Middleware (First Post!)
noname
noname

Posted on

I built an "Immune System" for AI Agents using Textual TUI & FastAPI Middleware (First Post!)

đź‘‹ Hello DEV Community!

A real-time prompt monitoring proxy, multi-LLM consensus router, and high-fidelity TUI dashboard built in Python.

This is my very first post here, and I'm thrilled to join the community!

I recently set out to solve a major issue in the autonomous AI agent space: safety and prompt manipulation. Autonomous agents need to make API calls, read files, and write code, but they are highly vulnerable to prompt injections, jailbreaks, and tool abuse.

To solve this, I built AegisOS — an inline, real-time middleware proxy and prompt-filtering shield, paired with a gorgeous terminal TUI dashboard to monitor and configure everything on-the-fly.

Here is a technical deep-dive into how I built it, the architecture, and what I learned along the way!


🛠️ The Architecture & How it Works

AegisOS operates as an intercepting middleware proxy between your AI agent clients and their LLM gateways.

TUI Interface Hotkeys & Screen Mapping

Hotkey Screen Name Screen Purpose
1 DASHBOARD Full system overview, telemetry gauges, and threat feed.
2 THREATS Deep catalog of all blocked exploit payloads and details.
3 AGENTS Monitor connected agent nodes, roles, and change isolation states.
4 MODELS Monitor active API gateways, latency, and consensus routing log.
5 TELEMETRY Real-time high-fidelity hardware consumption graphs.
6 SANDBOX Live exploit injector playground for custom and preset testing.
7 LOGS Continuous raw system operation and connection logs feed.
8 KEYS Manage, check, and test LLM provider keys directly inside the TUI.
9 MODEL CFG Customize provider models and trigger dynamic hot-reloads on-the-fly.
? HELP Full keyboard command summary and references card.
L LOCKDOWN Emergency global override—instantly isolate all active agents.
R REFRESH Refresh current screen data.
Q / ESC QUIT Safely close the TUI session.

Top comments (1)

Collapse
 
tracygjg profile image
Tracy Gilmore

Do you know if there is an inoculation or vaccine for AI?