See docs/DISCLAIMER_SNIPPET.md
Alpha Asi World Model
Current runnable path — 1.36.0
Mode: Research training. Explores generated grid worlds using a small learner and local API.
Prerequisites: torch, numpy, FastAPI and the demo requirements; CPU training can be slow.
After installation:
python -m alpha_factory_v1.demos check alpha_asi_world_model
python -m alpha_factory_v1.demos run alpha_asi_world_model
Expected result: Local web service on port 7860; stop with Ctrl+C.
Scope: Grid-world research only; ASI and generalization beyond the tested environments are not established.
The catalog explains installation, stopping, backups and recovery. Browser charts for legacy demos are labeled sample replays. Original research narratives and advanced scripts below are preserved; they do not expand the tested scope stated here.
What is actually trained
Each learner belongs to one fixed deterministic MiniWorld maze. Training uses an explicit shortest-path oracle for that maze, not MuZero self-play: value targets are discounted optimal returns (step reward -0.01, goal reward +1, terminal value zero); policy targets split probability equally between optimal actions. Unreachable states receive the discounted infinite step-penalty return. Observations contain agent position only, so learners are not transferred across layouts.
Replay records observation, action, reward, next observation and termination, plus
current/next value and policy targets. The equal-weight objective sums initial
value MSE, initial policy cross-entropy, recurrent reward MSE, recurrent value MSE,
recurrent policy cross-entropy, and latent next-state consistency MSE against a
detached encoding. Terminal next-policy targets are masked. Batch-size-one shapes
are preserved. Non-finite loss/gradients abort training. A zero loss while the
buffer is warming up is not evidence of learning; step_count and last_losses
identify actual updates.
The legacy mcts_policy entry point now performs bounded one-step PUCT-style
search with discounted reward-plus-value scoring. It is not full multi-depth
MuZero MCTS. Training, curriculum generation and the optional helper agents remain
research demonstrations, not evidence of ASI, general intelligence or real-world
performance. Missing PyTorch raises an explicit prerequisite error.
Finite CPU qualification (no provider keys or network required):
NO_LLM=1 ALPHA_ASI_DISABLE_AGENT_THREADS=1 ALPHA_ASI_DEVICE=cpu \
python -m pytest tests/test_world_model_training.py tests/test_world_model_demo.py -q
The target-oracle tests run without Torch; CPU gradient/head-update, finite-fit and learned-search tests explicitly skip if Torch is absent. The training file contains 14 cases; the combined command above also includes legacy demo tests. Pull-request and release CI require all 14 training cases to pass with zero skips on the pinned CPU Torch environment. The reward head uses nonlinear joint state/action features so goal-entry interactions are representable. Tests also check policy KL, latent consistency, gradient clipping and non-finite rejection. A skipped test is not training qualification. The fit test uses only 400 updates on 12 synthetic 2×2 transitions, with one CPU thread; it does not measure generalization.
This repository is a conceptual research prototype. References to "AGI" and "superintelligence" describe aspirational goals and do not indicate the presence of a real general intelligence. Use at your own risk. Nothing herein constitutes financial advice. MontrealAI and the maintainers accept no liability for losses incurred from using this software.
Each demo package exposes its own __version__ constant. The value marks the revision of that demo only and does not reflect the overall Alpha‑Factory release version.
α-ASI World-Model Demo 👁️✨
The open-ended curriculum engine + MuZero learner that powers the
Alpha-Factory v1 multi-agent runtime.
Out-Learn · Out-Think · Out-Design · Out-Strategise · Out-Execute
0 Table of Contents
- Why this demo matters
- Quick-start 🥑
- Offline setup
- High-level architecture 🗺️
- Meet the agents 🤖 (≥ 5)
- Runtime controls 🎮
- Deployment recipes 🚀
- Safety, antifragility & governance 🛡️
- Extending the demo 🧩
- Troubleshooting 🔧
- Production checklist ✅
- License & citation
1 Why this demo matters
Mission Prove that a constellation of agentic micro-services can independently grow their own synthetic worlds (open-ended POET curriculum), learn a general world-model (MuZero-style), automate strategy research, detect live alpha opportunities across industries, and march toward the α-ASI referenced by Vincent Boucher, President of MONTREAL.AI and QUEBEC.AI ⚡).
Success criteria ✓
| Pillar | Concrete demonstration |
|---|---|
| Open-Endedness | Automatic generation & evaluation of ever harder MiniWorld mazes |
| World-Models | MuZero learner predicts reward/value & policy without ground-truth rules |
| Multi-Agent | ≥ 5 independent Alpha-Factory agents coordinate via A2A bus |
| Cross-Industry Alpha | StrategyAgent spots profitable “alpha” events (simulated market feed) |
| Antifragility | SafetyAgent can freeze learner on NaN/spike; system self-recovers |
| Local-First | No internet or API keys required; LLM helpers activate only if keys provided |
2 Quick-start 🥑
# ░ Local Python (CPU or GPU)
pip install -r requirements.txt # torch, fastapi, uvicorn…
# All interactive helpers (`run_ui`, `run_headless`) require these packages.
torch is by far the largest dependency. Tests that import it are skipped when
the package is missing. For a short smoke test use:
pytest -m 'not e2e'
# new CLI (after `pip install -e .` at repo root)
alpha-asi-demo --demo # same as `python -m alpha_asi_world_model_demo --demo`
alpha-asi-demo --demo --no-llm # force-disable the optional LLM planner
python -m webbrowser http://localhost:7860 # dashboard & Swagger
# ░ One-liner Docker
python -m alpha_asi_world_model_demo --emit-docker
docker build -t alpha_asi_world_model .
docker run -p 7860:7860 alpha_asi_world_model
# ░ Helm (K8s)
python -m alpha_asi_world_model_demo --emit-helm
helm install alpha-asi ./helm_chart
# ░ Notebook
python -m alpha_asi_world_model_demo --emit-notebook
jupyter lab alpha_asi_world_model_demo.ipynb
# ░ Colab
Open `alpha_asi_world_model_colab.ipynb` in Google Colab for an end-to-end guided setup.
Non‑technical users can run it step by step:
1. Visit the notebook on GitHub and click **Open in Colab**.
2. Wait for the environment to start then choose **Runtime → Run all** (or run each cell manually).
3. The notebook installs requirements and launches the demo. When no API key is provided it automatically sets `NO_LLM=1`.
4. Interact with the dashboard in the new browser tab and run the final **Shut down** cell when done.
# ░ Shell helper
./deploy_alpha_asi_world_model_demo.sh
# ░ OpenAI Agents bridge
# uses ``OPENAI_API_KEY`` if set
python openai_agents_bridge.py
# ░ Google ADK gateway
ALPHA_FACTORY_ENABLE_ADK=true python openai_agents_bridge.py
Set OPENAI_API_KEY to connect the bridge to the OpenAI Agents platform.
Tip 💡 Set
ALPHA_ASI_SEED=<int>orgeneral.seedinconfig.yamlto reproduce identical curriculum runs. Tip 💡 SetALPHA_ASI_SILENT=1to hide the startup banner.
Offline setup
When working without internet access, first build a local wheelhouse:
mkdir -p /media/wheels
pip wheel -r requirements.txt -w /media/wheels
pip wheel -r ../../../requirements-dev.txt -w /media/wheels
Install and verify using the wheelhouse from the repository root:
WHEELHOUSE=/media/wheels AUTO_INSTALL_MISSING=1 ./codex/setup.sh
WHEELHOUSE=/media/wheels AUTO_INSTALL_MISSING=1 \
python check_env.py --auto-install --wheelhouse /media/wheels
See docs/OFFLINE_SETUP.md for a short reference.
Set NO_LLM=1 to disable the planning agent when no API key is available. The
deploy_alpha_asi_world_model_demo.sh helper exports this variable
automatically.
Define ALPHA_ASI_LLM_MODEL=gpt-4o-mini to change the planner's model.
Device selection
config.yaml exposes a device field controlling which accelerator PyTorch
uses. Accepted values are cpu, cuda and auto. With auto (the default),
the demo runs on GPU when torch.cuda.is_available() returns True and falls
back to CPU otherwise.
3 High-level architecture 🗺️
┌──────────────────────────────── Alpha-Factory Bus (A2A) ───────────────────────────────┐
│ │
│ ┌──────────────┐ curriculum ┌───────────┐ telemetry ┌────────────┐ │
│ │ StrategyAgent│───────────────►│ Orchestr. │──────────────►│ UI / WS │ │
│ └──────────────┘ │ (loop) │◄──────────────│ Interface │ │
│ ▲ ▲ └───────────┘ commands └────────────┘ │
│ │ │ new_env/reward ▲ │
│ plans │ │ loss stats │ halt │
│ │ └──────────────────────┐ │ │
│ ┌──────┴───────┐ context │ │ │
│ │ ResearchAgent│───────────────► Learner (MuZero) ◄─ SafetyAgent (loss guard) │
│ └──────────────┘ │ ▲ │
│ code patches │ │ │
│ ┌──────────────┐ │ │ gradients │
│ │ CodeGenAgent │────────────────┘ │ │
│ └──────────────┘ │ │
│ ▼ │
│ POET Generator → MiniWorlds (env pool) │
└────────────────────────────────────────────────────────────────────────────────────────┘
- All messages flow through a single in-proc A2A topic bus (swap for Redis/NATS at scale).
- MCP is used by ResearchAgent to attach rich “context blocks” to learner queries when an LLM key is supplied.
- Components comply with OpenAI Agents SDK & Google ADK lifecycle
(
init/step/shutdown), so they can be re-packaged as micro-services at will.
4 Meet the agents 🤖 (≥ 5)
| Topic 🛰 | Skill | How it contributes to End-to-End Alpha |
|---|---|---|
| planning_agent | Long-horizon curriculum sketching (optionally via GPT-4o) | Keeps learner near its “zone of proximal development” → faster capability gain |
| research_agent | Literature & data mining (papers, patents, SEC filings…) | Injects distilled insights; helps learner transfer skills across domains |
| strategy_agent | Real-time alpha detection (mock market feed 📈) | Signals lucrative industry opportunities; triggers env mutations that mimic them |
| codegen_agent | Auto-ML / network surgery | Evolves MuZero hyper-params & architecture → antifragile optimisation |
| market_agent | Streams synthetic or live financial ticks | Provides cross-domain stressor; validates Alpha-capture loops |
| safety_agent | Alignment guardrails | Halts on NaN/catastrophe; enforces resource quotas & ethical policies |
(If a concrete implementation is absent the stub logs every call, guaranteeing bus liveness even on a clean clone.)
5 Runtime controls 🎮
| REST | Use case |
|---|---|
GET /agents |
List active agent topics |
POST /command {"cmd":"new_env"} |
Force-spawn a fresh world |
POST /command {"cmd":"stop"} |
Graceful halt ⏸ |
WebSocket (/ws) streams JSON telemetry every ui_tick steps:
{"t":1234,"r":-0.01,"loss":0.872} → plug into Grafana or a custom React chart.
6 Deployment recipes 🚀
| Target | Guide |
|---|---|
| 🐳 Docker | Auto-generated Dockerfile (<100 MB slim). GPU builds: swap base for nvidia/cuda:runtime-12.4. |
| ☸️ Kubernetes | Run --emit-helm; edit values (replicaCount, resources.limits). Works on GKE, AKS, EKS, k3d. |
| 🐍 Pure Python | No Docker needed; just pip install -r requirements.txt. |
| 🔒 Air-gapped | Offline wheels; set NO_LLM=1 to disable the planner or omit API keys. |
| 🔑 Cloud LLM mode | Export OPENAI_API_KEY → PlanningAgent & ResearchAgent auto-upgrade to LLM assistants. |
7 Safety, antifragility & governance 🛡️
- Reward-hacking firewall — StrategyAgent & SafetyAgent cross-check any sudden reward spike; suspicious events quarantine the environment seed for forensic replay.
- Loss guard — Threshold
loss > 1e3orNaNtriggers globalstop. - Compute budget — Learner train loop obeys
torch.set_grad_enabled(False)for evaluation, cuts GPU utilisation to ≤ 80 %. - Policy logging — Every 10 k steps, MuZero weights hashed (SHA‑256) + signed for traceability.
- Audit-ready — All IPC messages dumped to
./logs/audit_<ts>.ndjson(regulator-friendly).
8 Extending the demo 🧩
One-file hackability yet enterprise scalability.
- New env type → subclass
MiniWorld(step/reset/obs), register inPOETGenerator.propose. - Swap learner → Implement
.act/.remember/.trainin a new class; StrategyAgent can trigger hot-swap via{"cmd":"swap_learner"}. - External micro-service → Reuse
BaseAgent; deploy as HTTP worker that bridges to A2A via WebSockets.
9 Troubleshooting 🔧
| Problem | Cause / Fix |
|---|---|
| “UI stalls” | Browser blocked WS → check console; ensure port 7860 reachable. |
| CUDA OOM | export TORCH_FORCE_CPU=1 or downsize net via CodeGenAgent. |
| Docker build slow | Add build-arg TORCH_WHL=<local-wheel> (offline). |
| K8s CrashLoop | kubectl logs; missing GPU driver or env var. |
| Hide banner | Set ALPHA_ASI_SILENT=1 before launching. |
Need help? Open an issue → @MontrealAI/alpha-factory-core.
10 Production checklist ✅
- Ensure
python3 --versionreturns 3.11–3.13. - Install dependencies:
pip install -r requirements.txt. - Launch via
./deploy_alpha_asi_world_model_demo.shand visithttp://localhost:7860. - The script sets
NO_LLM=1automatically whenOPENAI_API_KEYis unset. - Provide an
OPENAI_API_KEYto unlock planner features. - Set
NO_LLM=1to skip the LLM planner even when a key is provided.
11 License & citation
Apache‑2.0 © 2025 MONTREAL.AI
Please cite Alpha-Factory v1 👁️✨ — Multi-Agent AGENTIC α-AGI:
MONTREAL.AI (2025). Fully-Agentic α-AGI: Foundation World Models for α-ASI.
GitHub https://github.com/MontrealAI/AGI-Alpha-Agent-v0