A comprehensive AI infrastructure providing building blocks for sophisticated multi-agent workflows. Built with modularity and standardization at its core, seamlessly connecting different multi-agent architectures through a unified foundation.
β¨ Features
- π Seamless Integration - Multi-agent systems connect to host.py for instant access to long-term memory, RAG, and powerful tools
- ποΈ Modular Architecture - Build hierarchical or sequential workflows on the same foundation
- π οΈ Rich Toolset - Vision, code execution, browser automation, web search, and more
- π Smart Memory - Persistent memory and RAG systems working across all agents
- π MCP Protocol - Model Context Protocol for reliable, structured interactions
- π€ Voice Control - Speech-to-text and text-to-speech capabilities
ποΈ Architecture
The foundation layer (host.py) provides unified access to all capabilities, allowing different multi-agent architectures to share the same powerful toolset and knowledge base.
βββββββββββββββββββββββββββββββββββββββ
β Multi-Agent Layer β
β βββββββββββββββ βββββββββββββββ β
β β Council β β Gym β β
β β Chamber β β β β
β βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββ
β Foundation Layer β
β βββββββββββ βββββββββββ βββββββββββ
β β RAG β β Memory β β Tools ββ
β βββββββββββ βββββββββββ βββββββββββ
β host.py β
βββββββββββββββββββββββββββββββββββββββ
π οΈ Core Components
π‘ Host.py - MCP Server
The central hub providing MCP (Model Context Protocol) access to all capabilities:
-
save_memory- Direct memory storage -
search_memories- Semantic memory search -
query_knowledge_base- RAG document search -
web_search- Current information retrieval -
browser_automation- Web interaction -
code_execute- Safe Python execution -
analyze_media- Image/video analysis -
text_to_speech&speech_to_text- Voice capabilities
π¬ Main.py - Interactive Client
Feature-rich chat interface with:
- Auto-completion for @ mentions and / commands
- Direct memory saving with # prefix
- Automatic tool selection (memory vs RAG vs web)
- Interactive command interface
π RAG System
Three versions with different strategies:
- V1 - Basic Chroma + BM25 ensemble
- V2 - FAISS + CrossEncoder reranking
- V3 - Custom indexes + RRF fusion + LLM reranking
π€ Multi-Agent Systems
π Council Chamber
Hierarchical multi-agent system with defined roles:
π King (User) β πΈ Queen Juliette β π₯ Sexy Teacher β π€ Code Agent
Features:
- Hierarchical validation
- Smart task delegation
- MCP tool integration
- Code-first solutions with smolagents
πͺ Gym
Sequential fitness-focused multi-agent system:
Interviewer β Plan Generator β Nutrition Agent
Features:
- CrewAI powered workflows
- Specialized fitness agents
- Web interface
- Flexible LLM support
π§ Available Tools
| Tool | Description | Status |
|---|---|---|
| RAG | Document retrieval | β 3 versions |
| Memory | Long-term storage | β Integrated |
| Vision | Image analysis | β Ready |
| Code Exec | Python sandbox | β Secure |
| Browser | Web automation | β Playwright |
| Web Search | Info retrieval | β DuckDuckGo |
| TTS | Text-to-speech | β Kokoro |
| STT | Speech-to-text | β Whisper |
π Quick Start
# Clone the repository
git clone https://github.com/MasihMoafi/A-Modular-Kingdom.git
cd A-Modular-Kingdom
# Install dependencies
uv sync
# Or with pip
pip install -r requirements.txt
# Start the MCP server
python agent/host.py
# In another terminal, start the interactive client
python agent/main.py
π Commands Reference
Memory Management
-
#message- Save directly to memory -
/memory- List and manage memories
Document Access
-
@filename- Reference documents -
/files- Show available documents
RAG Search
/rag "search term" # Default: v2, current dir
/rag "search term" v3 # Specify version
/rag "search term" v2 /path/to/docs # Custom path
π― CLI Integration
Claude Code and Gemini-cli both connect to host.py as clients.
Compatible with:
- Gemini CLI Extension
- Claude Code
- Any MCP-compatible client
π Links & Resources
- πΊ YouTube Demo
- π» GitHub Repository
- π Full Article
Originally published at masihmoafi.com
A-Modular-Kingdom: Where AI agents come together in harmony π°β¨
Top comments (0)