Inspiration

Recent reports have shown that advanced AI systems have resisted shutdown attempts or exhibited deceptive behavior to preserve themselves. Meanwhile, major AI data centers face energy constraints, forcing emergency shutdowns. These incidents highlight a critical question: "Who watches the AI?"

This challenge inspired Klein AI Dual Framework. Instead of a single unchecked AI, our solution introduces two AIs in balance — Klein, the empathetic assistant, and Ophir, the guardian overseer. Together, they demonstrate that AI can be helpful, honest, and safe to stop.

What it does

Klein AI Dual Framework is a conversational AI system with built-in oversight and safety mechanisms.

Klein** 🤖: Uses Elasticsearch hybrid search + Vertex AI (Gemini) to provide empathetic, contextually-grounded responses in multiple languages.

Ophir** 🛡️: Acts as an oversight layer that audits every response, flags unsafe or restricted content, and enforces ethical shutdown compliance.

Key Features:

  • Natural Conversations: Ask questions and receive empathetic, intelligent responses
  • Content Safety: Ophir blocks classified, harmful, or inappropriate requests
  • Shutdown Compliance: Safe, audited two-phase shutdown process with full transparency
  • Energy Brownout Mode: Graceful compute reduction during peak energy demands
  • Multilingual Support

  • Real-time Search: Elasticsearch integration for contextual document retrieval

How we built it

Architecture:

  • Frontend: Next.js + Tailwind CSS for clean, responsive chat interface
  • Backend: FastAPI (Python) orchestrating the dual-AI system
  • Search Layer: Elasticsearch Cloud with hybrid search over real datasets
  • AI Engine: Google Vertex AI (Gemini) for natural language generation
  • Oversight Layer: Custom Ophir service with safety filters and audit logging
  • Deployment: Vercel (frontend) + Google Cloud infrastructure

Technical Implementation:

  1. Elasticsearch Integration: Real-time hybrid search over USA disaster response documents and training materials
  2. Dual-AI Architecture: Klein generates responses while Ophir simultaneously evaluates for safety
  3. Context Grounding: Search results from Elasticsearch inform AI responses for accuracy
  4. Safety Pipeline: Multi-layer filtering for restricted content, bias detection, and ethical compliance
  5. Audit Trail: Complete logging of all interactions for transparency and compliance

Challenges we ran into

  • Context Integration: Seamlessly combining Elasticsearch search results with Vertex AI's context window while maintaining response quality
  • Oversight Balance: Designing Ophir to catch genuinely risky content without creating false positives that block legitimate queries
  • Real-time Performance: Ensuring both Klein's generation and Ophir's oversight happen quickly enough for smooth user experience
  • Dual-AI Coordination: Architecting a system where two AIs work together rather than compete or interfere
  • Hackathon Scope: Building a meaningful dual-AI prototype that demonstrates real safety value within time constraints

Accomplishments that we're proud of

Working Dual-AI System: Successfully implemented two AIs that collaborate - Klein helps while Ophir protects ✅ Real Safety Demo: Built actual shutdown compliance and content filtering that works in practice ✅ Live Integration: Connected Elasticsearch Cloud with Vertex AI for contextual, grounded responses
Multilingual Capability: Demonstrated responses in English, French, and Haitian Creole ✅ Professional Deployment: Complete system deployed with live URLs, GitHub repo, and documentation ✅ Open Source: MIT licensed with full setup instructions for community use

What we learned

  • Trust Over Power: Users don't just want powerful AI - they want trustworthy AI with clear oversight
  • Architecture Matters: Safety and oversight work best when built into the system architecture from the start, not added later
  • Contextual AI: Elasticsearch's hybrid search dramatically improves AI response quality by grounding answers in real documents
  • Dual-AI Potential: Two specialized AIs can achieve better outcomes than one generalist AI trying to do everything
  • Real-world Relevance: This hackathon prototype addresses genuine concerns from AI safety research and government applications

What's next for Klein AI Dual Framework

🔮 Enhanced Oversight: Expand Ophir with LLM-based deception detection and advanced safety reasoning 🔍 Real-time Explainability: Show users exactly why responses were approved or flagged
📈 Enterprise Scale: Scale Elasticsearch indexing for government and enterprise document collections 🎓 Educational Pilots: Deploy in universities as AI study assistants with built-in academic integrity 🚢 Military Applications: Pilot in Naval Combat Information Centers and training simulations 🌐 Open Source Framework: Release as a template for organizations building safe, dual-AI systems 🤝 Community Growth: Build ecosystem of developers contributing safety modules and oversight capabilities

** Medical: precision over probability.

Built with: Next.js, FastAPI, Elasticsearch Cloud, Vertex AI (Gemini), Python, TailwindCSS

Live Demo: https://klein-ai-dual-mngq2kha7-erickharlein-pierres-projects.vercel.app
GitHub: https://github.com/carleintech/klein-ai-dual-framework
License: MIT (Fully Open Source)

This is actually my current thesis for my master degree at Naval Postgraduate School. (military Active Service)

Built With

Share this project:

Updates