Frontend (items 1-10):
- WebSocket streaming integration with useWebSocket hook
- Admin Dashboard UI (status, voices, agents, governance tabs)
- Voice playback UI (TTS/STT integration)
- Settings/Preferences page (conversation style, sliders)
- Responsive/mobile layout (breakpoints at 480px, 768px)
- Dark/light theme with CSS variables and localStorage
- Error handling & loading states (retry, empty state, disabled input)
- Authentication UI (login page, Bearer token, logout)
- Head visualization improvements (active/speaking states, animations)
- Consequence/Ethics dashboard (lessons, consequences, insights tabs)
Backend stubs (items 11-21):
- Tool connectors: DocsConnector (text/md/PDF), DBConnector (SQLite/Postgres), CodeRunnerConnector (Python/JS/Bash/Ruby sandboxed)
- STT adapter: WhisperSTTAdapter, AzureSTTAdapter
- Multi-modal interface adapters: Visual, Haptic, Gesture, Biometric
- SSE streaming endpoint (/v1/sessions/{id}/stream/sse)
- Multi-tenant support (X-Tenant-ID header, tenant CRUD)
- Plugin marketplace/registry (register, install, list)
- Backup/restore endpoints
- Versioned API negotiation (Accept-Version header, deprecation)
Infrastructure (items 22-26):
- docker-compose.yml (API + Postgres + Redis + frontend)
- .env.example with all configurable vars
- gunicorn.conf.py production ASGI config
- Prometheus metrics collector and /metrics endpoint
- Structured JSON logging configuration
Documentation (items 27-29):
- Architecture docs with module layout and subsystem descriptions
- Quickstart guide with setup, API tour, and test instructions
Tests (items 30-32):
- Integration tests: 25 end-to-end API tests
- Frontend tests: 10 Vitest tests for hooks (useTheme, useAuth)
- Load/performance tests: latency and throughput benchmarks
- Connector tests: 16 tests for Docs, DB, CodeRunner
- Multi-modal adapter tests: 9 tests
- Metrics collector tests: 5 tests
- STT adapter tests: 2 tests
511 Python tests passing, 10 frontend tests passing, 0 ruff errors.
Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
89 lines
4.8 KiB
Markdown
89 lines
4.8 KiB
Markdown
# FusionAGI Architecture
|
|
|
|
## Overview
|
|
|
|
FusionAGI is a modular AGI orchestration framework built on the **Dvādaśa** (12-headed) architecture. Multiple specialized reasoning heads analyze each prompt independently, and a Witness agent synthesizes their outputs into a consensus response.
|
|
|
|
## Core Architecture
|
|
|
|
```
|
|
User Prompt
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────┐
|
|
│ Orchestrator (core/) │
|
|
│ Decompose → Fan-out → Synthesize │
|
|
├─────────────────────────────────────────┤
|
|
│ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │
|
|
│ │Logic│ │Creat│ │Resrch│ │Safety│ ... │
|
|
│ │Head │ │Head │ │Head │ │Head │ │
|
|
│ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ │
|
|
│ └───────┴───────┴───────┘ │
|
|
│ Witness Agent │
|
|
│ (consensus synthesis) │
|
|
└──────────────┬──────────────────────────┘
|
|
│
|
|
┌──────────┼──────────┐
|
|
▼ ▼ ▼
|
|
┌────────┐ ┌────────┐ ┌────────┐
|
|
│Advisory│ │Conseq. │ │Adaptive│
|
|
│Governce│ │Engine │ │Ethics │
|
|
└────────┘ └────────┘ └────────┘
|
|
```
|
|
|
|
## Module Layout
|
|
|
|
| Module | Responsibility |
|
|
|---|---|
|
|
| `core/` | Orchestrator, event bus, state manager, persistence |
|
|
| `agents/` | HeadAgent, WitnessAgent, Planner, Critic, Reasoner |
|
|
| `adapters/` | LLM providers (OpenAI, TTS, STT), caching |
|
|
| `schemas/` | Pydantic models — Task, Message, Plan, etc. |
|
|
| `tools/` | Built-in tools (file, HTTP, shell) + connectors (docs, DB, code runner) |
|
|
| `memory/` | InMemory and Postgres backends |
|
|
| `governance/` | SafetyPipeline, PolicyEngine, AdaptiveEthics, ConsequenceEngine |
|
|
| `reasoning/` | NativeReasoning, Metacognition, Interpretability |
|
|
| `world_model/` | CausalWorldModel with self-modification prediction |
|
|
| `verification/` | ClaimVerifier for output validation |
|
|
| `interfaces/` | Multi-modal adapters (visual, haptic, gesture, biometric) |
|
|
| `maa/` | Manufacturing Assurance Authority (geometry, physics, embodiment) |
|
|
| `api/` | FastAPI app, routes, middleware, metrics |
|
|
|
|
## Key Subsystems
|
|
|
|
### Consequence Engine (`governance/consequence_engine.py`)
|
|
Every decision is a choice with alternatives, risk/reward estimates, and actual outcomes. The system learns from surprise (difference between predicted and actual outcomes).
|
|
|
|
### Adaptive Ethics (`governance/adaptive_ethics.py`)
|
|
Consequentialist ethical framework that learns from experience rather than static rules. Lessons evolve weights based on observed outcomes. Advisory mode — observations, not enforcement.
|
|
|
|
### Causal World Model (`world_model/causal.py`)
|
|
Predicts action→effect relationships from execution history. Includes self-modification prediction — the system models how its own capabilities change from self-improvement actions.
|
|
|
|
### InsightBus (`governance/insight_bus.py`)
|
|
Cross-head shared learning channel. Heads contribute observations that other heads can learn from, enabling collaborative intelligence.
|
|
|
|
### PersistentLearningStore (`governance/persistent_store.py`)
|
|
File-backed persistence for consequence data, ethical lessons, and risk histories across restarts.
|
|
|
|
### Metacognition (`reasoning/metacognition.py`)
|
|
Self-awareness of knowledge boundaries. Evaluates reasoning quality, evidence sufficiency, and recommends when to seek more information.
|
|
|
|
### Plugin System (`agents/head_registry.py`)
|
|
Extensible head registry with decorator-based registration. Custom heads can contribute to ethics and consequences via hooks.
|
|
|
|
## API Architecture
|
|
|
|
- **FastAPI** with async support and lifespan management
|
|
- **Bearer token auth** (optional, via `FUSIONAGI_API_KEY`)
|
|
- **Advisory rate limiting** (logs, doesn't block)
|
|
- **Version negotiation** via `Accept-Version` header
|
|
- **SSE streaming** for token-by-token responses
|
|
- **WebSocket** for real-time bidirectional communication
|
|
- **Multi-tenant** isolation via `X-Tenant-ID` header
|
|
- **Prometheus metrics** at `/metrics` (when enabled)
|
|
|
|
## Governance Philosophy
|
|
|
|
All governance is **advisory by default** (`GovernanceMode.ADVISORY`). The system observes, logs, and advises — but does not prevent action. Mistakes are learning opportunities. Every decision, its alternatives, and its consequences are tracked for the ethical learning loop.
|