-
Notifications
You must be signed in to change notification settings - Fork 0
System Architecture
This document provides a comprehensive overview of Adastrea Director's architecture, covering the core components, data flow, and design decisions.
Adastrea Director is built on a modular, extensible architecture that supports multiple deployment modes while sharing the same core AI backend.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Deployment Layer β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β Standalone Mode β β Plugin Mode β β
β β (Python GUI) β β (UE C++ + IPC) β β
β ββββββββββ¬ββββββββββ ββββββββββ¬ββββββββββ β
βββββββββββββΌβββββββββββββββββββββββββββββββββββΌβββββββββββββββ
β β
ββββββββββββ¬ββββββββββββββββββββββββ
β
ββββββββββββΌββββββββββββββββββββββββββββββββββββ
β Core AI Backend (Python) β
β ββββββββββββββββββββββββββββββββββββββββββ β
β β RAG System (Phase 1) β β
β β β’ Document Ingestion β β
β β β’ Vector Database (ChromaDB) β β
β β β’ Query Processing β β
β β β’ LLM Integration β β
β ββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββ β
β β Planning System (Phase 2) β β
β β β’ Goal Analysis β β
β β β’ Task Decomposition β β
β β β’ Dependency Resolution β β
β β β’ Code Generation β β
β ββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββ β
β β Agent System (Phase 3) β β
β β β’ Agent Orchestrator β β
β β β’ Event Bus β β
β β β’ Shared State β β
β β β’ Remote Control API β β
β ββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββΌββββββββββββββββββββββββββββββββββββ
β External Services β
β β’ LLM APIs (Gemini, OpenAI, Ollama) β
β β’ Embedding Models (HuggingFace, OpenAI) β
β β’ GitHub API (for repo ingestion) β
ββββββββββββββββββββββββββββββββββββββββββββββββ
The Retrieval-Augmented Generation system provides context-aware Q&A capabilities.
Key Components:
-
Document Ingestion:
ingest.py,ingest_game_repo.py - Vector Database: ChromaDB for storing embeddings
-
Query Processing:
main.py- handles user queries -
LLM Integration:
llm_config.py- manages LLM providers
Data Flow:
Documents β Chunking β Embedding β Vector DB β Similarity Search β LLM β Answer
Technologies:
- ChromaDB: Vector database for embeddings
- Sentence Transformers: Default embedding model
- LangChain: Document processing and chunking
- OpenAI/Gemini: LLM providers
Intelligent goal decomposition and task planning.
Key Components:
-
Goal Analysis:
goal_analysis_agent.py- analyzes and classifies goals -
Task Decomposition:
task_decomposition_agent.py- breaks down goals into tasks -
Planning CLI:
planning_cli.py,planner.py- user interfaces -
Models:
planning_models.py- data structures for plans and tasks
Data Flow:
Goal β Analysis β Classification β Decomposition β Task Graph β Action Plan
Features:
- Dependency resolution
- Effort estimation
- Priority assignment
- Code generation suggestions
- Multiple export formats (Markdown, JSON, Text)
Autonomous agents for proactive monitoring and assistance.
Key Components:
-
Agent Orchestrator:
agent_orchestrator_cli.py- manages agent lifecycle - Event Bus: Pub/sub system for agent communication
- Shared State: Thread-safe state management
-
Remote Control API:
remote_control/- external integration -
Dashboard:
agent_dashboard.py- real-time monitoring
Agent Types:
- Performance Agent: Monitors and optimizes performance
- Bug Detection Agent: Identifies and analyzes bugs
- Code Quality Agent: Reviews code quality and suggests improvements
Architecture Pattern:
Orchestrator β Event Bus β Agents
β
Shared State
β
Remote Control API
Purpose: Development, testing, and standalone use
Components:
- Python CLI (
main.py,planner.py,agent_orchestrator_cli.py) - Python GUI (
gui_director.py) - Agent Dashboard (
agent_dashboard.py)
Advantages:
- β Easy to debug and test
- β Rapid iteration
- β Platform-independent
- β Full feature access
Use Cases:
- Documentation Q&A
- Planning and task management
- Agent development and testing
- Non-UE game development
Purpose: Integrated in-editor workflow
Components:
- C++ UE Plugin (
Plugins/AdastreaDirector/) - Python Backend (same as standalone)
- IPC Bridge (inter-process communication)
- UE Python API integration
Advantages:
- β Integrated editor experience
- β Direct UE Python API access
- β No context switching
- β Editor automation
Architecture:
UE Editor
β (IPC/HTTP)
Python Backend β UE Python API
Use Cases:
- In-editor documentation search
- Asset and actor queries
- Console command execution
- Editor automation
Location: ./chroma_db
Structure:
chroma_db/
βββ index/ # Vector indices
βββ metadata/ # Document metadata
βββ storage/ # Persistent storage
Features:
- Persistent storage
- Fast similarity search
- Metadata filtering
- Incremental updates
Location: ~/.adastrea/config.json
Contents:
{
"api_keys": {
"gemini": "encrypted_key",
"openai": "encrypted_key"
},
"settings": {
"llm_provider": "gemini",
"embedding_provider": "huggingface"
}
}Security:
- Keys are encrypted with machine-specific salt
- Config is stored in user directory (not repository)
- Environment variables override config
Location: In-memory + optional persistence
Structure:
{
"agents": {
"performance": {"status": "running", "metrics": {...}},
"bug_detection": {"status": "idle", "last_run": ...}
},
"events": [...],
"shared_state": {...}
}Agents communicate via an event bus:
# Agent publishes event
event_bus.publish("performance.warning", {
"metric": "fps",
"value": 30,
"threshold": 60
})
# Other agents subscribe
event_bus.subscribe("performance.*", callback)Benefits:
- Loose coupling between agents
- Scalable architecture
- Easy to add new agents
- Asynchronous processing
Traditional request-response for user queries:
# User query
query = "How do I implement feature X?"
# System processes
context = vector_db.similarity_search(query)
answer = llm.generate(context, query)
# Return response
return answerPlugin communicates with backend via HTTP/IPC:
// C++ Plugin sends request
FString Response = SendHTTPRequest("http://localhost:8000/query", Query);
// Python backend processes
@app.route('/query', methods=['POST'])
def query():
result = director.query(request.json['query'])
return jsonify(result)Different LLM providers implement the same interface:
class LLMProvider:
def generate(self, prompt: str) -> str:
pass
class GeminiProvider(LLMProvider):
def generate(self, prompt: str) -> str:
# Gemini-specific implementation
pass
class OpenAIProvider(LLMProvider):
def generate(self, prompt: str) -> str:
# OpenAI-specific implementation
passAgents observe events without tight coupling:
class Agent:
def __init__(self, event_bus):
self.event_bus = event_bus
self.event_bus.subscribe("*", self.on_event)
def on_event(self, event):
# React to event
passOrchestrator creates agents via factory:
class AgentFactory:
@staticmethod
def create_agent(agent_type: str):
if agent_type == "performance":
return PerformanceAgent()
elif agent_type == "bug_detection":
return BugDetectionAgent()Single source of truth for agent state:
class SharedState:
_instance = None
def __new__(cls):
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance- Documents: Up to 10,000 chunks
- Agents: Up to 10 concurrent agents
- Users: Single user (local deployment)
Multi-User Support:
- Add authentication and authorization
- Separate databases per user/project
- Load balancing for LLM requests
Distributed Agents:
- Deploy agents as separate microservices
- Use message queue (RabbitMQ, Kafka) instead of in-memory event bus
- Horizontal scaling for agent workers
Cloud Deployment:
- Containerize with Docker
- Deploy to Kubernetes
- Use cloud vector databases (Pinecone, Weaviate)
- β Keys encrypted at rest
- β Never committed to repository
- β Machine-specific encryption
- β Environment variables supported
- β All data processed locally (except LLM API calls)
- β No telemetry or analytics
- β User controls all data
- β Option for local LLMs (Ollama)
- β No arbitrary code execution
- β Sandboxed environments for future code gen
- β User review required for generated code
- First Query: 5-10 seconds (model loading)
- Subsequent Queries: 1-3 seconds
- Ingestion: ~100 documents/minute
- Database Size: ~1MB per 1000 chunks
- Goal Analysis: 2-5 seconds
- Task Decomposition: 5-15 seconds (depends on goal complexity)
- Plan Export: <1 second
- Agent Startup: <1 second
- Event Processing: <100ms
- Dashboard Update: 500ms (configurable)
- Python 3.9+: Main language
- ChromaDB: Vector database
- LangChain: Document processing
- Sentence Transformers: Embeddings
- tkinter: GUI framework
- Google Gemini: Recommended (free tier)
- OpenAI GPT: Alternative
- Ollama: Local deployment
- C++: Plugin implementation
- UE Python API: Editor automation
- Slate UI: User interface
- HTTP/IPC: Backend communication
- pytest: Testing framework (230+ tests)
- black: Code formatting
- mypy: Type checking
- GitHub Actions: CI/CD
- Agent Architecture - Deep dive into P3 agents
- Deployment Modes - Choosing the right mode
- Contributing Guide - Development and testing
- Main README - Testing and API reference
Adastrea Director | GitHub | Issues | Discussions
Building tomorrow's game development tools, today.