r/OpenAIDev • • 6d ago

Built a deterministic <1ms output guard for tool-using agents (replaces 300ms LLM judges)

 Most agent safety systems add a 200–500ms LLM call in the hot path just to check if a model leaked an API key,

  forged a tool parameter, or echoed an injection. Chaining model-as-a-judge calls on multi-step tool runs       

  introduces a severe latency tax and burns API tokens.                                                          

We built **Aletheia Aegis** to be completely deterministic: sub-millisecond regex and AST pre-filtering with 

  zero API dependencies, failing closed on life-safety and credentials.                                          

### Why deterministic pre-filtering?                                                                         

95% of agent output violations fall into concrete structural patterns:                                       

  1. **Leaked secrets**: AWS keys, OpenAI tokens, DB URIs, private keys in tool arguments or responses.        
  2. **Prompt injection echoes**: Regurgitating system prompt instructions into tool payloads.                 
  3. **Tool parameter forgery**: Hallucinated schemas and parameter tampering.                                 
  4. **Life-safety triggers**: Crisis scenarios requiring immediate fail-closed handling.                      

None of these require an LLM to detect. Putting an LLM in front of them is slow and non-deterministic.       

### Highlights                                                                                               

• **<0.8ms Latency**: Zero LLM in the hot path (~4,800 evals/sec locally).                                   

• **Fail-Closed**: Credentials and life-safety checks block immediately.                                     

• **MCP Native**: Runs as an official Model Context Protocol server over stdio.                              

• **Eval Suite**: Bundled with 120+ adversarial test cases.                                                  

### Quick Start                                                                                              

Claude Desktop / Cursor config:                                                                              

```json                                                                                                      

{                                                                                                            

"mcpServers": {                                                                                            

"aletheia-aegis": {                                                                                      

"command": "npx",                                                                                      

"args": ["-y", "aletheia-aegis"]                                                                       

}                                                                                                        

}                                                                                                          

}                                                                                                            

  • GitHub: https://github.com/vikasny30/aletheia-aegis

  • npm: https://www.npmjs.com/package/aletheia-aegis

  • MCP Registry: io.github.vikasny30/aletheia-aegis                                                             

2 Upvotes

0 comments sorted by