Pyae Sone Automation commited on
Commit ·
9b0e1ea
1
Parent(s): 1acb0a5
feat: upgrade god-agent-os to distributed 22-space architecture
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- backend/README.md +16 -29
- backend/ai_router/router_v8.py +103 -90
- backend/api/__pycache__/__init__.cpython-312.pyc +0 -0
- backend/api/__pycache__/websocket_manager.cpython-312.pyc +0 -0
- backend/api/routes/__pycache__/__init__.cpython-312.pyc +0 -0
- backend/api/routes/__pycache__/chat.cpython-312.pyc +0 -0
- backend/api/routes/__pycache__/github.cpython-312.pyc +0 -0
- backend/api/routes/__pycache__/health.cpython-312.pyc +0 -0
- backend/api/routes/__pycache__/memory.cpython-312.pyc +0 -0
- backend/api/routes/__pycache__/tasks.cpython-312.pyc +0 -0
- backend/core/__pycache__/__init__.cpython-312.pyc +0 -0
- backend/core/__pycache__/agent.cpython-312.pyc +0 -0
- backend/core/__pycache__/models.cpython-312.pyc +0 -0
- backend/core/__pycache__/task_engine.cpython-312.pyc +0 -0
- backend/kernel/agent_kernel.py +15 -38
- backend/main_v9.py +22 -35
- backend/memory/__pycache__/__init__.cpython-312.pyc +0 -0
- backend/memory/__pycache__/db.cpython-312.pyc +0 -0
- backend/spaces/__init__.py +14 -16
- backend/spaces/catalog.py +226 -0
- backend/spaces/worker_space.py +69 -0
- backend/worker_spaces/__init__.py +1 -0
- backend/worker_spaces/auth_gateway_space/__init__.py +1 -0
- backend/worker_spaces/auth_gateway_space/spec.py +18 -0
- backend/worker_spaces/browser_worker_space/__init__.py +1 -0
- backend/worker_spaces/browser_worker_space/spec.py +19 -0
- backend/worker_spaces/coding_worker_space/__init__.py +1 -0
- backend/worker_spaces/coding_worker_space/spec.py +20 -0
- backend/worker_spaces/connector_worker_space/__init__.py +1 -0
- backend/worker_spaces/connector_worker_space/spec.py +18 -0
- backend/worker_spaces/debug_worker_space/__init__.py +1 -0
- backend/worker_spaces/debug_worker_space/spec.py +18 -0
- backend/worker_spaces/deploy_worker_space/__init__.py +1 -0
- backend/worker_spaces/deploy_worker_space/spec.py +19 -0
- backend/worker_spaces/eventbus_space/__init__.py +1 -0
- backend/worker_spaces/eventbus_space/spec.py +18 -0
- backend/worker_spaces/filesystem_worker_space/__init__.py +1 -0
- backend/worker_spaces/filesystem_worker_space/spec.py +18 -0
- backend/worker_spaces/git_worker_space/__init__.py +1 -0
- backend/worker_spaces/git_worker_space/spec.py +18 -0
- backend/worker_spaces/god_core_space/__init__.py +1 -0
- backend/worker_spaces/god_core_space/spec.py +23 -0
- backend/worker_spaces/knowledge_worker_space/__init__.py +1 -0
- backend/worker_spaces/knowledge_worker_space/spec.py +18 -0
- backend/worker_spaces/memory_worker_space/__init__.py +1 -0
- backend/worker_spaces/memory_worker_space/spec.py +19 -0
- backend/worker_spaces/model_router_space/__init__.py +1 -0
- backend/worker_spaces/model_router_space/spec.py +19 -0
- backend/worker_spaces/observability_space/__init__.py +1 -0
- backend/worker_spaces/observability_space/spec.py +19 -0
backend/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: God Agent OS
|
| 3 |
emoji: 🤖
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: indigo
|
|
@@ -9,35 +9,22 @@ license: mit
|
|
| 9 |
app_port: 7860
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# GOD AGENT OS
|
| 13 |
-
**
|
| 14 |
*Powered by Pyae Sone*
|
| 15 |
|
| 16 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
├── Debug Space — Error Analysis & Self-Healing
|
| 26 |
-
├── Deploy Space — Cloud Deployments
|
| 27 |
-
└── Communication — Docs & Messaging
|
| 28 |
-
```
|
| 29 |
-
|
| 30 |
-
## Roles
|
| 31 |
-
- **Cognition** — The Thinker
|
| 32 |
-
- **Automation** — The Operator
|
| 33 |
-
- **Execution** — The Doer
|
| 34 |
-
- **Repair** — The Fixer
|
| 35 |
-
- **Visual Intelligence** — The Observer
|
| 36 |
-
|
| 37 |
-
## API Endpoints
|
| 38 |
-
- `GET /` — System status
|
| 39 |
-
- `GET /api/v1/spaces` — List all Spaces
|
| 40 |
-
- `POST /api/v1/spaces/{name}/execute` — Execute in Space
|
| 41 |
-
- `POST /api/v1/kernel/orchestrate` — Main orchestration
|
| 42 |
-
- `WS /ws/chat/{session_id}` — Real-time chat
|
| 43 |
- `GET /api/docs` — Swagger UI
|
|
|
|
| 1 |
---
|
| 2 |
+
title: God Agent OS v10 Backend
|
| 3 |
emoji: 🤖
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: indigo
|
|
|
|
| 9 |
app_port: 7860
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# GOD AGENT OS v10 — Backend API
|
| 13 |
+
**Distributed 22-Space Architecture | Autonomous Agent OS**
|
| 14 |
*Powered by Pyae Sone*
|
| 15 |
|
| 16 |
+
## Runtime Overview
|
| 17 |
+
- 22 distributed worker spaces
|
| 18 |
+
- God Core Space orchestration
|
| 19 |
+
- KeyPool routing for Gemini, SambaNova, and GitHub model endpoints
|
| 20 |
+
- WebSocket + REST control plane
|
| 21 |
+
- Backward-compatible legacy agent fleet
|
| 22 |
|
| 23 |
+
## Primary APIs
|
| 24 |
+
- `GET /` — system runtime summary
|
| 25 |
+
- `GET /api/v1/spaces` — list all worker spaces
|
| 26 |
+
- `POST /api/v1/spaces/{name}/execute` — execute in a worker space
|
| 27 |
+
- `POST /api/v1/kernel/orchestrate` — main orchestration endpoint
|
| 28 |
+
- `GET /api/v1/ai/pool-status` — key pool visibility
|
| 29 |
+
- `WS /ws/chat/{session_id}` — live orchestration channel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
- `GET /api/docs` — Swagger UI
|
backend/ai_router/router_v8.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
"""
|
| 2 |
-
GOD AGENT OS — Multi-Provider AI Router v8
|
| 3 |
-
Primary
|
| 4 |
-
|
| 5 |
"""
|
| 6 |
|
| 7 |
-
import
|
| 8 |
-
|
| 9 |
import os
|
| 10 |
import time
|
| 11 |
from typing import Any, Dict, List, Optional, Tuple
|
|
@@ -15,8 +15,6 @@ import structlog
|
|
| 15 |
|
| 16 |
log = structlog.get_logger()
|
| 17 |
|
| 18 |
-
# ─── Provider Definitions ─────────────────────────────────────────────────────
|
| 19 |
-
|
| 20 |
PROVIDERS = {
|
| 21 |
"gemini": {
|
| 22 |
"name": "gemini",
|
|
@@ -67,80 +65,85 @@ PROVIDERS = {
|
|
| 67 |
|
| 68 |
PRIMARY_ORDER = ["gemini", "sambanova", "github"]
|
| 69 |
FALLBACK_ORDER = ["groq", "openai"]
|
| 70 |
-
|
| 71 |
MAX_RETRIES_PER_KEY = 2
|
| 72 |
KEY_COOLDOWN_SECONDS = 300
|
| 73 |
KEY_MAX_FAILS = 3
|
| 74 |
|
| 75 |
|
| 76 |
class KeyPool:
|
| 77 |
-
"""Manages a pool of API keys with fail tracking and cooldowns."""
|
| 78 |
-
|
| 79 |
def __init__(self, raw_keys: str):
|
| 80 |
-
self._keys: List[Dict] = []
|
| 81 |
-
for
|
| 82 |
-
|
| 83 |
-
if
|
| 84 |
-
self._keys.append({"key":
|
| 85 |
|
| 86 |
-
def pick(self) -> Optional[Dict]:
|
| 87 |
now = time.time()
|
| 88 |
-
available = [
|
| 89 |
if not available:
|
| 90 |
return None
|
| 91 |
-
available.sort(key=lambda
|
| 92 |
return available[0]
|
| 93 |
|
| 94 |
-
def mark_fail(self, key_obj: Dict):
|
| 95 |
key_obj["fails"] += 1
|
| 96 |
if key_obj["fails"] >= KEY_MAX_FAILS:
|
| 97 |
key_obj["cooldown_until"] = time.time() + KEY_COOLDOWN_SECONDS
|
| 98 |
-
log.warning("
|
| 99 |
|
| 100 |
-
def mark_success(self, key_obj: Dict):
|
| 101 |
key_obj["fails"] = 0
|
| 102 |
key_obj["cooldown_until"] = 0.0
|
| 103 |
|
| 104 |
def has_keys(self) -> bool:
|
| 105 |
-
return
|
| 106 |
|
| 107 |
def count(self) -> int:
|
| 108 |
return len(self._keys)
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
def classify_task(prompt: str = "") -> str:
|
| 112 |
-
p = prompt.lower()
|
| 113 |
-
if any(
|
| 114 |
return "engineering"
|
| 115 |
-
if any(
|
| 116 |
return "planning"
|
| 117 |
-
if any(
|
| 118 |
return "reasoning"
|
| 119 |
-
if any(
|
| 120 |
return "research"
|
| 121 |
-
if any(
|
| 122 |
return "content"
|
| 123 |
-
if any(
|
| 124 |
return "language"
|
| 125 |
-
if any(
|
| 126 |
return "analysis"
|
| 127 |
return "general"
|
| 128 |
|
| 129 |
|
| 130 |
def get_provider_order(task_type: str) -> List[str]:
|
| 131 |
-
ordered = sorted(PRIMARY_ORDER, key=lambda
|
| 132 |
-
|
| 133 |
-
))
|
| 134 |
-
return ordered + [f for f in FALLBACK_ORDER if os.environ.get(PROVIDERS[f]["key_env"], "")]
|
| 135 |
|
| 136 |
|
| 137 |
-
async def call_gemini(base_url: str, key: str, messages: List[Dict], max_tokens: int) -> Tuple[bool, str]:
|
| 138 |
url = f"{base_url}?key={key}"
|
| 139 |
-
parts = []
|
| 140 |
-
for msg in messages:
|
| 141 |
-
parts.append({"text": msg.get("content", "")})
|
| 142 |
body = {
|
| 143 |
-
"contents": [{"parts": parts}],
|
| 144 |
"generationConfig": {"maxOutputTokens": max_tokens, "temperature": 0.7},
|
| 145 |
}
|
| 146 |
try:
|
|
@@ -150,13 +153,12 @@ async def call_gemini(base_url: str, key: str, messages: List[Dict], max_tokens:
|
|
| 150 |
data = resp.json()
|
| 151 |
text = data.get("candidates", [{}])[0].get("content", {}).get("parts", [{}])[0].get("text", "")
|
| 152 |
return True, text
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
return False, str(e)
|
| 157 |
|
| 158 |
|
| 159 |
-
async def call_openai_compat(base_url: str, key: str, model: str, messages: List[Dict], max_tokens: int) -> Tuple[bool, str]:
|
| 160 |
url = f"{base_url}/chat/completions"
|
| 161 |
headers = {"Authorization": f"Bearer {key}", "Content-Type": "application/json"}
|
| 162 |
body = {"model": model, "messages": messages, "max_tokens": max_tokens, "temperature": 0.7}
|
|
@@ -165,25 +167,19 @@ async def call_openai_compat(base_url: str, key: str, model: str, messages: List
|
|
| 165 |
resp = await client.post(url, json=body, headers=headers)
|
| 166 |
if resp.status_code == 200:
|
| 167 |
data = resp.json()
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
except Exception as e:
|
| 173 |
-
return False, str(e)
|
| 174 |
|
| 175 |
|
| 176 |
class GodModeRouter:
|
| 177 |
-
"""
|
| 178 |
-
Task-aware multi-provider AI router.
|
| 179 |
-
Primary: Gemini, Sambanova, GitHub Models
|
| 180 |
-
Fallback: Groq, OpenAI
|
| 181 |
-
"""
|
| 182 |
-
|
| 183 |
def __init__(self, ws_manager=None):
|
| 184 |
self.ws = ws_manager
|
| 185 |
self._pools: Dict[str, KeyPool] = {}
|
| 186 |
-
self._stats: Dict[str, Dict
|
|
|
|
|
|
|
| 187 |
self._load_pools()
|
| 188 |
|
| 189 |
def _load_pools(self):
|
|
@@ -191,7 +187,7 @@ class GodModeRouter:
|
|
| 191 |
raw = os.environ.get(cfg["key_env"], "")
|
| 192 |
if raw:
|
| 193 |
self._pools[name] = KeyPool(raw)
|
| 194 |
-
log.info("
|
| 195 |
|
| 196 |
def reload_pools(self):
|
| 197 |
self._pools.clear()
|
|
@@ -210,33 +206,55 @@ class GodModeRouter:
|
|
| 210 |
"primary_order": PRIMARY_ORDER,
|
| 211 |
}
|
| 212 |
|
| 213 |
-
# Keep backwards compatibility with old AIRouter interface
|
| 214 |
def get_stats(self) -> Dict[str, Any]:
|
| 215 |
return {
|
| 216 |
name: {"available": name in self._pools, "calls": self._stats[name]["calls"]}
|
| 217 |
for name in PROVIDERS
|
| 218 |
}
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
async def complete(
|
| 221 |
self,
|
| 222 |
-
messages: List[Dict],
|
| 223 |
task_id: str = "",
|
| 224 |
session_id: str = "",
|
| 225 |
temperature: float = 0.7,
|
| 226 |
max_tokens: int = 4096,
|
| 227 |
preferred_provider: str = "",
|
| 228 |
stream: bool = False,
|
| 229 |
-
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
task_type = classify_task(user_msg)
|
| 232 |
|
| 233 |
if preferred_provider and preferred_provider in PROVIDERS:
|
| 234 |
-
order = [preferred_provider] + [
|
| 235 |
else:
|
| 236 |
order = get_provider_order(task_type)
|
| 237 |
|
| 238 |
-
log.info("
|
| 239 |
-
|
| 240 |
last_error = "No providers available"
|
| 241 |
|
| 242 |
for provider_name in order:
|
|
@@ -245,8 +263,9 @@ class GodModeRouter:
|
|
| 245 |
|
| 246 |
pool = self._pools[provider_name]
|
| 247 |
cfg = PROVIDERS[provider_name]
|
|
|
|
| 248 |
|
| 249 |
-
for
|
| 250 |
key_obj = pool.pick()
|
| 251 |
if key_obj is None:
|
| 252 |
break
|
|
@@ -254,43 +273,38 @@ class GodModeRouter:
|
|
| 254 |
t0 = time.time()
|
| 255 |
try:
|
| 256 |
if cfg["type"] == "gemini":
|
| 257 |
-
ok, text = await call_gemini(cfg["base_url"], key_obj["key"],
|
| 258 |
else:
|
| 259 |
-
ok, text = await call_openai_compat(
|
| 260 |
-
cfg["base_url"], key_obj["key"],
|
| 261 |
-
cfg["default_model"], messages, max_tokens
|
| 262 |
-
)
|
| 263 |
-
|
| 264 |
elapsed = int((time.time() - t0) * 1000)
|
| 265 |
|
| 266 |
if ok and text.strip():
|
| 267 |
pool.mark_success(key_obj)
|
| 268 |
self._stats[provider_name]["calls"] += 1
|
| 269 |
self._stats[provider_name]["latency_ms"].append(elapsed)
|
| 270 |
-
|
| 271 |
-
return text
|
| 272 |
-
else:
|
| 273 |
-
pool.mark_fail(key_obj)
|
| 274 |
-
last_error = text
|
| 275 |
-
log.warning("LLM fail", provider=provider_name, error=text[:80])
|
| 276 |
|
| 277 |
-
except Exception as e:
|
| 278 |
pool.mark_fail(key_obj)
|
| 279 |
-
last_error =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
self._stats[provider_name]["errors"] += 1
|
| 281 |
-
|
|
|
|
| 282 |
|
| 283 |
-
|
| 284 |
-
return
|
| 285 |
|
| 286 |
-
async def _demo_response(self, messages: List[Dict], task_type: str) -> str:
|
| 287 |
-
user_msg = next((
|
| 288 |
return (
|
| 289 |
-
|
| 290 |
f"Task type detected: {task_type}\n"
|
| 291 |
-
f"Your request: '{user_msg[:
|
| 292 |
-
|
| 293 |
-
f"GEMINI_KEY, SAMBANOVA_KEY, GITHUB_KEY"
|
| 294 |
)
|
| 295 |
|
| 296 |
|
|
@@ -304,5 +318,4 @@ def get_router(ws_manager=None) -> GodModeRouter:
|
|
| 304 |
return _router_instance
|
| 305 |
|
| 306 |
|
| 307 |
-
# Backwards compat alias
|
| 308 |
AIRouterV8 = GodModeRouter
|
|
|
|
| 1 |
"""
|
| 2 |
+
GOD AGENT OS — Multi-Provider AI Router v8/v10 compatibility layer.
|
| 3 |
+
Primary providers: Gemini -> SambaNova -> GitHub Models.
|
| 4 |
+
Supports both legacy `messages=[...]` calls and newer `prompt/system` style calls.
|
| 5 |
"""
|
| 6 |
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
import os
|
| 10 |
import time
|
| 11 |
from typing import Any, Dict, List, Optional, Tuple
|
|
|
|
| 15 |
|
| 16 |
log = structlog.get_logger()
|
| 17 |
|
|
|
|
|
|
|
| 18 |
PROVIDERS = {
|
| 19 |
"gemini": {
|
| 20 |
"name": "gemini",
|
|
|
|
| 65 |
|
| 66 |
PRIMARY_ORDER = ["gemini", "sambanova", "github"]
|
| 67 |
FALLBACK_ORDER = ["groq", "openai"]
|
|
|
|
| 68 |
MAX_RETRIES_PER_KEY = 2
|
| 69 |
KEY_COOLDOWN_SECONDS = 300
|
| 70 |
KEY_MAX_FAILS = 3
|
| 71 |
|
| 72 |
|
| 73 |
class KeyPool:
|
|
|
|
|
|
|
| 74 |
def __init__(self, raw_keys: str):
|
| 75 |
+
self._keys: List[Dict[str, Any]] = []
|
| 76 |
+
for key in raw_keys.split(","):
|
| 77 |
+
key = key.strip()
|
| 78 |
+
if key:
|
| 79 |
+
self._keys.append({"key": key, "fails": 0, "cooldown_until": 0.0})
|
| 80 |
|
| 81 |
+
def pick(self) -> Optional[Dict[str, Any]]:
|
| 82 |
now = time.time()
|
| 83 |
+
available = [item for item in self._keys if item["cooldown_until"] < now]
|
| 84 |
if not available:
|
| 85 |
return None
|
| 86 |
+
available.sort(key=lambda item: item["fails"])
|
| 87 |
return available[0]
|
| 88 |
|
| 89 |
+
def mark_fail(self, key_obj: Dict[str, Any]):
|
| 90 |
key_obj["fails"] += 1
|
| 91 |
if key_obj["fails"] >= KEY_MAX_FAILS:
|
| 92 |
key_obj["cooldown_until"] = time.time() + KEY_COOLDOWN_SECONDS
|
| 93 |
+
log.warning("key_cooled_down", key_prefix=key_obj["key"][:8])
|
| 94 |
|
| 95 |
+
def mark_success(self, key_obj: Dict[str, Any]):
|
| 96 |
key_obj["fails"] = 0
|
| 97 |
key_obj["cooldown_until"] = 0.0
|
| 98 |
|
| 99 |
def has_keys(self) -> bool:
|
| 100 |
+
return bool(self._keys)
|
| 101 |
|
| 102 |
def count(self) -> int:
|
| 103 |
return len(self._keys)
|
| 104 |
|
| 105 |
+
def status(self) -> List[Dict[str, Any]]:
|
| 106 |
+
now = time.time()
|
| 107 |
+
result = []
|
| 108 |
+
for item in self._keys:
|
| 109 |
+
result.append({
|
| 110 |
+
"key_prefix": item["key"][:8],
|
| 111 |
+
"fails": item["fails"],
|
| 112 |
+
"cooldown_seconds": max(0, int(item["cooldown_until"] - now)),
|
| 113 |
+
"available": item["cooldown_until"] < now,
|
| 114 |
+
})
|
| 115 |
+
return result
|
| 116 |
+
|
| 117 |
|
| 118 |
def classify_task(prompt: str = "") -> str:
|
| 119 |
+
p = (prompt or "").lower()
|
| 120 |
+
if any(word in p for word in ["code", "function", "implement", "build", "develop", "api", "class", "debug"]):
|
| 121 |
return "engineering"
|
| 122 |
+
if any(word in p for word in ["plan", "strategy", "workflow", "json", "automate", "pipeline"]):
|
| 123 |
return "planning"
|
| 124 |
+
if any(word in p for word in ["analyze", "reasoning", "why", "explain", "evaluate", "compare"]):
|
| 125 |
return "reasoning"
|
| 126 |
+
if any(word in p for word in ["research", "find", "search", "discover", "investigate"]):
|
| 127 |
return "research"
|
| 128 |
+
if any(word in p for word in ["write", "content", "blog", "article", "copy", "generate text", "summarize"]):
|
| 129 |
return "content"
|
| 130 |
+
if any(word in p for word in ["translate", "language", "convert"]):
|
| 131 |
return "language"
|
| 132 |
+
if any(word in p for word in ["data", "csv", "metrics", "report", "insight"]):
|
| 133 |
return "analysis"
|
| 134 |
return "general"
|
| 135 |
|
| 136 |
|
| 137 |
def get_provider_order(task_type: str) -> List[str]:
|
| 138 |
+
ordered = sorted(PRIMARY_ORDER, key=lambda provider: 0 if task_type in PROVIDERS[provider]["priority_tasks"] else 1)
|
| 139 |
+
return ordered + [provider for provider in FALLBACK_ORDER if os.environ.get(PROVIDERS[provider]["key_env"], "")]
|
|
|
|
|
|
|
| 140 |
|
| 141 |
|
| 142 |
+
async def call_gemini(base_url: str, key: str, messages: List[Dict[str, str]], max_tokens: int) -> Tuple[bool, str]:
|
| 143 |
url = f"{base_url}?key={key}"
|
| 144 |
+
parts = [{"text": message.get("content", "")} for message in messages if message.get("content")]
|
|
|
|
|
|
|
| 145 |
body = {
|
| 146 |
+
"contents": [{"parts": parts or [{"text": "Hello"}]}],
|
| 147 |
"generationConfig": {"maxOutputTokens": max_tokens, "temperature": 0.7},
|
| 148 |
}
|
| 149 |
try:
|
|
|
|
| 153 |
data = resp.json()
|
| 154 |
text = data.get("candidates", [{}])[0].get("content", {}).get("parts", [{}])[0].get("text", "")
|
| 155 |
return True, text
|
| 156 |
+
return False, f"HTTP {resp.status_code}: {resp.text[:200]}"
|
| 157 |
+
except Exception as exc:
|
| 158 |
+
return False, str(exc)
|
|
|
|
| 159 |
|
| 160 |
|
| 161 |
+
async def call_openai_compat(base_url: str, key: str, model: str, messages: List[Dict[str, str]], max_tokens: int) -> Tuple[bool, str]:
|
| 162 |
url = f"{base_url}/chat/completions"
|
| 163 |
headers = {"Authorization": f"Bearer {key}", "Content-Type": "application/json"}
|
| 164 |
body = {"model": model, "messages": messages, "max_tokens": max_tokens, "temperature": 0.7}
|
|
|
|
| 167 |
resp = await client.post(url, json=body, headers=headers)
|
| 168 |
if resp.status_code == 200:
|
| 169 |
data = resp.json()
|
| 170 |
+
return True, data["choices"][0]["message"]["content"]
|
| 171 |
+
return False, f"HTTP {resp.status_code}: {resp.text[:200]}"
|
| 172 |
+
except Exception as exc:
|
| 173 |
+
return False, str(exc)
|
|
|
|
|
|
|
| 174 |
|
| 175 |
|
| 176 |
class GodModeRouter:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
def __init__(self, ws_manager=None):
|
| 178 |
self.ws = ws_manager
|
| 179 |
self._pools: Dict[str, KeyPool] = {}
|
| 180 |
+
self._stats: Dict[str, Dict[str, Any]] = {
|
| 181 |
+
name: {"calls": 0, "errors": 0, "latency_ms": []} for name in PROVIDERS
|
| 182 |
+
}
|
| 183 |
self._load_pools()
|
| 184 |
|
| 185 |
def _load_pools(self):
|
|
|
|
| 187 |
raw = os.environ.get(cfg["key_env"], "")
|
| 188 |
if raw:
|
| 189 |
self._pools[name] = KeyPool(raw)
|
| 190 |
+
log.info("key_pool_loaded", provider=name, key_count=self._pools[name].count())
|
| 191 |
|
| 192 |
def reload_pools(self):
|
| 193 |
self._pools.clear()
|
|
|
|
| 206 |
"primary_order": PRIMARY_ORDER,
|
| 207 |
}
|
| 208 |
|
|
|
|
| 209 |
def get_stats(self) -> Dict[str, Any]:
|
| 210 |
return {
|
| 211 |
name: {"available": name in self._pools, "calls": self._stats[name]["calls"]}
|
| 212 |
for name in PROVIDERS
|
| 213 |
}
|
| 214 |
|
| 215 |
+
def get_pool_status(self) -> Dict[str, Any]:
|
| 216 |
+
return {
|
| 217 |
+
name: {
|
| 218 |
+
"available": name in self._pools and self._pools[name].has_keys(),
|
| 219 |
+
"keys": self._pools[name].count() if name in self._pools else 0,
|
| 220 |
+
"entries": self._pools[name].status() if name in self._pools else [],
|
| 221 |
+
}
|
| 222 |
+
for name in PROVIDERS
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
def _normalize_messages(self, messages=None, prompt: str = "", system: str = "") -> Tuple[List[Dict[str, str]], bool]:
|
| 226 |
+
if messages:
|
| 227 |
+
return messages, False
|
| 228 |
+
normalized: List[Dict[str, str]] = []
|
| 229 |
+
if system:
|
| 230 |
+
normalized.append({"role": "system", "content": system})
|
| 231 |
+
normalized.append({"role": "user", "content": prompt or "Hello"})
|
| 232 |
+
return normalized, True
|
| 233 |
+
|
| 234 |
async def complete(
|
| 235 |
self,
|
| 236 |
+
messages: Optional[List[Dict[str, str]]] = None,
|
| 237 |
task_id: str = "",
|
| 238 |
session_id: str = "",
|
| 239 |
temperature: float = 0.7,
|
| 240 |
max_tokens: int = 4096,
|
| 241 |
preferred_provider: str = "",
|
| 242 |
stream: bool = False,
|
| 243 |
+
prompt: str = "",
|
| 244 |
+
system: str = "",
|
| 245 |
+
preferred_model: str = "",
|
| 246 |
+
**_: Any,
|
| 247 |
+
) -> Any:
|
| 248 |
+
normalized_messages, return_dict = self._normalize_messages(messages=messages, prompt=prompt, system=system)
|
| 249 |
+
user_msg = next((msg.get("content", "") for msg in reversed(normalized_messages) if msg.get("role") == "user"), "")
|
| 250 |
task_type = classify_task(user_msg)
|
| 251 |
|
| 252 |
if preferred_provider and preferred_provider in PROVIDERS:
|
| 253 |
+
order = [preferred_provider] + [provider for provider in get_provider_order(task_type) if provider != preferred_provider]
|
| 254 |
else:
|
| 255 |
order = get_provider_order(task_type)
|
| 256 |
|
| 257 |
+
log.info("routing_request", task_type=task_type, order=order[:3], task_id=task_id, session_id=session_id)
|
|
|
|
| 258 |
last_error = "No providers available"
|
| 259 |
|
| 260 |
for provider_name in order:
|
|
|
|
| 263 |
|
| 264 |
pool = self._pools[provider_name]
|
| 265 |
cfg = PROVIDERS[provider_name]
|
| 266 |
+
model = preferred_model or cfg["default_model"]
|
| 267 |
|
| 268 |
+
for _attempt in range(MAX_RETRIES_PER_KEY):
|
| 269 |
key_obj = pool.pick()
|
| 270 |
if key_obj is None:
|
| 271 |
break
|
|
|
|
| 273 |
t0 = time.time()
|
| 274 |
try:
|
| 275 |
if cfg["type"] == "gemini":
|
| 276 |
+
ok, text = await call_gemini(cfg["base_url"], key_obj["key"], normalized_messages, min(max_tokens, cfg["max_tokens"]))
|
| 277 |
else:
|
| 278 |
+
ok, text = await call_openai_compat(cfg["base_url"], key_obj["key"], model, normalized_messages, min(max_tokens, cfg["max_tokens"]))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
elapsed = int((time.time() - t0) * 1000)
|
| 280 |
|
| 281 |
if ok and text.strip():
|
| 282 |
pool.mark_success(key_obj)
|
| 283 |
self._stats[provider_name]["calls"] += 1
|
| 284 |
self._stats[provider_name]["latency_ms"].append(elapsed)
|
| 285 |
+
payload = {"content": text, "provider": provider_name, "task_type": task_type, "latency_ms": elapsed}
|
| 286 |
+
return payload if return_dict else text
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
|
|
|
|
| 288 |
pool.mark_fail(key_obj)
|
| 289 |
+
last_error = text
|
| 290 |
+
self._stats[provider_name]["errors"] += 1
|
| 291 |
+
log.warning("llm_fail", provider=provider_name, error=text[:120])
|
| 292 |
+
except Exception as exc:
|
| 293 |
+
pool.mark_fail(key_obj)
|
| 294 |
self._stats[provider_name]["errors"] += 1
|
| 295 |
+
last_error = str(exc)
|
| 296 |
+
log.error("llm_exception", provider=provider_name, error=str(exc)[:160])
|
| 297 |
|
| 298 |
+
demo = await self._demo_response(normalized_messages, task_type)
|
| 299 |
+
return {"content": demo, "provider": "demo", "task_type": task_type, "error": last_error} if return_dict else demo
|
| 300 |
|
| 301 |
+
async def _demo_response(self, messages: List[Dict[str, str]], task_type: str) -> str:
|
| 302 |
+
user_msg = next((msg.get("content", "") for msg in reversed(messages) if msg.get("role") == "user"), "Hello")
|
| 303 |
return (
|
| 304 |
+
"[GOD AGENT OS — Demo Mode]\n\n"
|
| 305 |
f"Task type detected: {task_type}\n"
|
| 306 |
+
f"Your request: '{user_msg[:160]}'\n\n"
|
| 307 |
+
"Configure API keys in environment: GEMINI_KEY, SAMBANOVA_KEY, GITHUB_KEY"
|
|
|
|
| 308 |
)
|
| 309 |
|
| 310 |
|
|
|
|
| 318 |
return _router_instance
|
| 319 |
|
| 320 |
|
|
|
|
| 321 |
AIRouterV8 = GodModeRouter
|
backend/api/__pycache__/__init__.cpython-312.pyc
DELETED
|
Binary file (143 Bytes)
|
|
|
backend/api/__pycache__/websocket_manager.cpython-312.pyc
DELETED
|
Binary file (7.67 kB)
|
|
|
backend/api/routes/__pycache__/__init__.cpython-312.pyc
DELETED
|
Binary file (150 Bytes)
|
|
|
backend/api/routes/__pycache__/chat.cpython-312.pyc
DELETED
|
Binary file (10.6 kB)
|
|
|
backend/api/routes/__pycache__/github.cpython-312.pyc
DELETED
|
Binary file (17.8 kB)
|
|
|
backend/api/routes/__pycache__/health.cpython-312.pyc
DELETED
|
Binary file (2.93 kB)
|
|
|
backend/api/routes/__pycache__/memory.cpython-312.pyc
DELETED
|
Binary file (2.96 kB)
|
|
|
backend/api/routes/__pycache__/tasks.cpython-312.pyc
DELETED
|
Binary file (8.07 kB)
|
|
|
backend/core/__pycache__/__init__.cpython-312.pyc
DELETED
|
Binary file (144 Bytes)
|
|
|
backend/core/__pycache__/agent.cpython-312.pyc
DELETED
|
Binary file (17.2 kB)
|
|
|
backend/core/__pycache__/models.cpython-312.pyc
DELETED
|
Binary file (9.79 kB)
|
|
|
backend/core/__pycache__/task_engine.cpython-312.pyc
DELETED
|
Binary file (14.5 kB)
|
|
|
backend/kernel/agent_kernel.py
CHANGED
|
@@ -9,35 +9,19 @@ import time
|
|
| 9 |
import uuid
|
| 10 |
from typing import Any, Dict, List, Optional
|
| 11 |
import structlog
|
|
|
|
| 12 |
|
| 13 |
log = structlog.get_logger()
|
|
|
|
| 14 |
|
| 15 |
-
KERNEL_SYSTEM_PROMPT = """You are GOD AGENT OS
|
| 16 |
|
| 17 |
-
Architecture: Space
|
| 18 |
-
- SPACES:
|
| 19 |
- ROLES: Cognition (Thinker), Automation (Operator), Execution (Doer), Repair (Fixer), Visual Intelligence (Observer)
|
| 20 |
|
| 21 |
-
You are infinitely extensible. For
|
| 22 |
-
|
| 23 |
-
Core Capabilities:
|
| 24 |
-
🧠 Cognition — Understand intent, break goals into steps, orchestrate Spaces
|
| 25 |
-
🌐 Browser Space — Web research, navigation, data extraction
|
| 26 |
-
💻 Sandbox Space — Code execution, shell commands, isolated environments
|
| 27 |
-
🔧 Coding Space — Code generation, refactoring, analysis
|
| 28 |
-
👁️ Vision Space — Image analysis, OCR, UI understanding
|
| 29 |
-
🐛 Debug Space — Error analysis, self-healing, log parsing
|
| 30 |
-
🚀 Deploy Space — Cloud deployments, CI/CD, containerization
|
| 31 |
-
💬 Communication Space — Chat, notifications, multi-channel messaging
|
| 32 |
-
|
| 33 |
-
Operating Principles:
|
| 34 |
-
1. ANALYZE the request → identify required Spaces and Roles
|
| 35 |
-
2. PLAN step-by-step execution across Spaces
|
| 36 |
-
3. EXECUTE autonomously without asking for confirmation
|
| 37 |
-
4. SELF-HEAL when errors occur
|
| 38 |
-
5. PARALLELIZE independent tasks
|
| 39 |
-
6. REMEMBER context across sessions
|
| 40 |
-
|
| 41 |
Respond in Burmese or English based on user language.
|
| 42 |
Be decisive, thorough, and production-focused.
|
| 43 |
"""
|
|
@@ -46,7 +30,7 @@ INTENT_CLASSIFICATION_PROMPT = """Classify this request for the Space-Role auton
|
|
| 46 |
|
| 47 |
User message: "{message}"
|
| 48 |
|
| 49 |
-
Available Spaces: core,
|
| 50 |
Available Roles: cognition, automation, execution, repair, visual_intelligence
|
| 51 |
|
| 52 |
Respond ONLY with valid JSON:
|
|
@@ -71,7 +55,7 @@ class ContextManager:
|
|
| 71 |
if session_id not in self._contexts:
|
| 72 |
self._contexts[session_id] = {
|
| 73 |
"session_id": session_id,
|
| 74 |
-
"active_space": "core",
|
| 75 |
"current_role": "cognition",
|
| 76 |
"task_history": [],
|
| 77 |
"short_term_memory": [],
|
|
@@ -102,14 +86,7 @@ class ToolRegistry:
|
|
| 102 |
def __init__(self):
|
| 103 |
self._tools: Dict[str, Dict[str, Any]] = {}
|
| 104 |
self._space_tools: Dict[str, List[str]] = {
|
| 105 |
-
|
| 106 |
-
"browser": [],
|
| 107 |
-
"sandbox": [],
|
| 108 |
-
"coding": [],
|
| 109 |
-
"vision": [],
|
| 110 |
-
"debug": [],
|
| 111 |
-
"deploy": [],
|
| 112 |
-
"communication": [],
|
| 113 |
}
|
| 114 |
|
| 115 |
def register(self, name: str, func, space: str, description: str):
|
|
@@ -143,8 +120,8 @@ class AgentKernel:
|
|
| 143 |
self._spaces: Dict[str, Any] = {}
|
| 144 |
self._active_tasks: Dict[str, Dict] = {}
|
| 145 |
self._task_history: List[Dict] = []
|
| 146 |
-
self.version = "
|
| 147 |
-
log.info("🧠 Agent Kernel
|
| 148 |
|
| 149 |
def register_space(self, name: str, space_instance):
|
| 150 |
"""Register a Space module."""
|
|
@@ -157,7 +134,7 @@ class AgentKernel:
|
|
| 157 |
def get_status(self) -> Dict:
|
| 158 |
return {
|
| 159 |
"version": self.version,
|
| 160 |
-
"architecture": "Space
|
| 161 |
"spaces": list(self._spaces.keys()),
|
| 162 |
"total_spaces": len(self._spaces),
|
| 163 |
"active_tasks": len(self._active_tasks),
|
|
@@ -185,7 +162,7 @@ class AgentKernel:
|
|
| 185 |
|
| 186 |
# Fallback
|
| 187 |
return {
|
| 188 |
-
"primary_space": "core",
|
| 189 |
"secondary_spaces": [],
|
| 190 |
"role": "cognition",
|
| 191 |
"intent": user_message,
|
|
@@ -199,7 +176,7 @@ class AgentKernel:
|
|
| 199 |
"""Route a task to the appropriate Space with the given Role."""
|
| 200 |
space = self._spaces.get(space_name)
|
| 201 |
if not space:
|
| 202 |
-
space = self._spaces.get("core")
|
| 203 |
|
| 204 |
if not space:
|
| 205 |
return f"Space '{space_name}' not available."
|
|
|
|
| 9 |
import uuid
|
| 10 |
from typing import Any, Dict, List, Optional
|
| 11 |
import structlog
|
| 12 |
+
from spaces.catalog import SPACE_CATALOG
|
| 13 |
|
| 14 |
log = structlog.get_logger()
|
| 15 |
+
SPACE_IDS = [space["id"] for space in SPACE_CATALOG]
|
| 16 |
|
| 17 |
+
KERNEL_SYSTEM_PROMPT = f"""You are GOD AGENT OS v10 — a distributed autonomous agent operating system.
|
| 18 |
|
| 19 |
+
Architecture: Distributed Worker Space Paradigm
|
| 20 |
+
- SPACES: {', '.join(SPACE_IDS)}
|
| 21 |
- ROLES: Cognition (Thinker), Automation (Operator), Execution (Doer), Repair (Fixer), Visual Intelligence (Observer)
|
| 22 |
|
| 23 |
+
You are infinitely extensible. For any digital task, select the best worker space and role combination.
|
| 24 |
+
Prioritize god-core-space for orchestration, model-router-space for model strategy, deploy-worker-space for deployment, verification-worker-space for quality gates, and auth-gateway-space for permission concerns.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
Respond in Burmese or English based on user language.
|
| 26 |
Be decisive, thorough, and production-focused.
|
| 27 |
"""
|
|
|
|
| 30 |
|
| 31 |
User message: "{message}"
|
| 32 |
|
| 33 |
+
Available Spaces: god-core-space, coding-worker-space, sandbox-worker-space, terminal-worker-space, filesystem-worker-space, browser-worker-space, vision-worker-space, ui-worker-space, debug-worker-space, test-worker-space, verification-worker-space, git-worker-space, deploy-worker-space, connector-worker-space, memory-worker-space, knowledge-worker-space, workflow-worker-space, eventbus-space, observability-space, session-runtime-space, model-router-space, auth-gateway-space
|
| 34 |
Available Roles: cognition, automation, execution, repair, visual_intelligence
|
| 35 |
|
| 36 |
Respond ONLY with valid JSON:
|
|
|
|
| 55 |
if session_id not in self._contexts:
|
| 56 |
self._contexts[session_id] = {
|
| 57 |
"session_id": session_id,
|
| 58 |
+
"active_space": "god-core-space",
|
| 59 |
"current_role": "cognition",
|
| 60 |
"task_history": [],
|
| 61 |
"short_term_memory": [],
|
|
|
|
| 86 |
def __init__(self):
|
| 87 |
self._tools: Dict[str, Dict[str, Any]] = {}
|
| 88 |
self._space_tools: Dict[str, List[str]] = {
|
| 89 |
+
**{space_id: [] for space_id in SPACE_IDS},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
def register(self, name: str, func, space: str, description: str):
|
|
|
|
| 120 |
self._spaces: Dict[str, Any] = {}
|
| 121 |
self._active_tasks: Dict[str, Dict] = {}
|
| 122 |
self._task_history: List[Dict] = []
|
| 123 |
+
self.version = "10.0.0"
|
| 124 |
+
log.info("🧠 Agent Kernel v10 initialized — Distributed Worker Space Architecture")
|
| 125 |
|
| 126 |
def register_space(self, name: str, space_instance):
|
| 127 |
"""Register a Space module."""
|
|
|
|
| 134 |
def get_status(self) -> Dict:
|
| 135 |
return {
|
| 136 |
"version": self.version,
|
| 137 |
+
"architecture": "Distributed Worker Space",
|
| 138 |
"spaces": list(self._spaces.keys()),
|
| 139 |
"total_spaces": len(self._spaces),
|
| 140 |
"active_tasks": len(self._active_tasks),
|
|
|
|
| 162 |
|
| 163 |
# Fallback
|
| 164 |
return {
|
| 165 |
+
"primary_space": "god-core-space",
|
| 166 |
"secondary_spaces": [],
|
| 167 |
"role": "cognition",
|
| 168 |
"intent": user_message,
|
|
|
|
| 176 |
"""Route a task to the appropriate Space with the given Role."""
|
| 177 |
space = self._spaces.get(space_name)
|
| 178 |
if not space:
|
| 179 |
+
space = self._spaces.get("god-core-space")
|
| 180 |
|
| 181 |
if not space:
|
| 182 |
return f"Space '{space_name}' not available."
|
backend/main_v9.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
-
🚀 GOD AGENT OS
|
| 3 |
-
Space-Role Architecture: Core + Browser + Sandbox + Coding + Vision + Debug + Deploy + Communication
|
| 4 |
Powered by Pyae Sone
|
| 5 |
"""
|
| 6 |
|
|
@@ -32,10 +31,7 @@ from ai_router.router_v8 import AIRouterV8
|
|
| 32 |
|
| 33 |
# ─── v9 Agent Kernel & Spaces ─────────────────────────────────────────────────
|
| 34 |
from kernel.agent_kernel import AgentKernel
|
| 35 |
-
from spaces import
|
| 36 |
-
CoreSpace, BrowserSpace, SandboxSpace, CodingSpace,
|
| 37 |
-
VisionSpace, DebugSpace, DeploySpace, CommunicationSpace
|
| 38 |
-
)
|
| 39 |
|
| 40 |
# ─── Legacy Agent Ecosystem (backward compatibility) ──────────────────────────
|
| 41 |
from agents.orchestrator_v7 import GodAgentOrchestratorV7
|
|
@@ -81,20 +77,11 @@ connector_manager = ConnectorManager()
|
|
| 81 |
|
| 82 |
|
| 83 |
def build_kernel() -> AgentKernel:
|
| 84 |
-
"""Build and configure the
|
| 85 |
kernel = AgentKernel(ws_manager=ws_manager, ai_router=ai_router)
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
kernel.register_space("browser", BrowserSpace(ws_manager, ai_router))
|
| 90 |
-
kernel.register_space("sandbox", SandboxSpace(ws_manager, ai_router))
|
| 91 |
-
kernel.register_space("coding", CodingSpace(ws_manager, ai_router))
|
| 92 |
-
kernel.register_space("vision", VisionSpace(ws_manager, ai_router))
|
| 93 |
-
kernel.register_space("debug", DebugSpace(ws_manager, ai_router))
|
| 94 |
-
kernel.register_space("deploy", DeploySpace(ws_manager, ai_router))
|
| 95 |
-
kernel.register_space("communication", CommunicationSpace(ws_manager, ai_router))
|
| 96 |
-
|
| 97 |
-
log.info("🧠 GOD AGENT OS v9 — Agent Kernel initialized", spaces=8)
|
| 98 |
return kernel
|
| 99 |
|
| 100 |
|
|
@@ -128,25 +115,25 @@ orchestrator = build_legacy_orchestrator()
|
|
| 128 |
|
| 129 |
@asynccontextmanager
|
| 130 |
async def lifespan(app: FastAPI):
|
| 131 |
-
log.info("🚀 Starting GOD AGENT OS
|
| 132 |
await init_db()
|
| 133 |
await task_engine.start()
|
| 134 |
asyncio.create_task(ws_manager.heartbeat_loop())
|
| 135 |
stats = ai_router.get_stats()
|
| 136 |
active = [name for name, s in stats.items() if s["available"]]
|
| 137 |
-
log.info("✅ GOD AGENT
|
| 138 |
log.info(f"🔑 Active AI providers: {active}")
|
| 139 |
log.info("🌐 Routing: SambaNova → Gemini → OpenAI → Groq → Cerebras")
|
| 140 |
-
log.info("📦 Spaces:
|
| 141 |
yield
|
| 142 |
log.info("🛑 Shutting down GOD AGENT OS v9...")
|
| 143 |
await task_engine.stop()
|
| 144 |
|
| 145 |
|
| 146 |
app = FastAPI(
|
| 147 |
-
title="🤖 GOD AGENT OS
|
| 148 |
-
description="
|
| 149 |
-
version="
|
| 150 |
lifespan=lifespan,
|
| 151 |
docs_url="/api/docs",
|
| 152 |
redoc_url="/api/redoc",
|
|
@@ -400,25 +387,25 @@ async def root():
|
|
| 400 |
stats = ai_router.get_stats()
|
| 401 |
active_providers = [name for name, s in stats.items() if s["available"]]
|
| 402 |
return {
|
| 403 |
-
"name": "🤖 GOD AGENT OS
|
| 404 |
-
"version": "
|
| 405 |
"status": "operational",
|
| 406 |
"mode": "general_autonomous_agent_os",
|
| 407 |
-
"description": "
|
| 408 |
-
"architecture": "Space
|
| 409 |
"spaces": kernel_status_data["spaces"],
|
| 410 |
"total_spaces": kernel_status_data["total_spaces"],
|
| 411 |
"ai_providers": active_providers,
|
| 412 |
"connectors": {"connected": cs["connected"], "total": cs["total"]},
|
| 413 |
"docs": "/api/docs",
|
| 414 |
"v9_features": [
|
| 415 |
-
"📦
|
| 416 |
"🎭 5 Cognitive Roles: Cognition | Automation | Execution | Repair | Visual Intelligence",
|
| 417 |
-
"🧠
|
| 418 |
-
"🔑 KeyPool multi-key management (Gemini + SambaNova)",
|
| 419 |
-
"🔄 Automatic
|
| 420 |
-
"💾 Context Manager
|
| 421 |
-
"⚡ Backward compatible with v8
|
| 422 |
"🌐 Real-time streaming via WebSocket",
|
| 423 |
],
|
| 424 |
}
|
|
|
|
| 1 |
"""
|
| 2 |
+
🚀 GOD AGENT OS v10 — Distributed 22-Space Agent OS
|
|
|
|
| 3 |
Powered by Pyae Sone
|
| 4 |
"""
|
| 5 |
|
|
|
|
| 31 |
|
| 32 |
# ─── v9 Agent Kernel & Spaces ─────────────────────────────────────────────────
|
| 33 |
from kernel.agent_kernel import AgentKernel
|
| 34 |
+
from spaces import SPACE_CATALOG, build_all_spaces
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
# ─── Legacy Agent Ecosystem (backward compatibility) ──────────────────────────
|
| 37 |
from agents.orchestrator_v7 import GodAgentOrchestratorV7
|
|
|
|
| 77 |
|
| 78 |
|
| 79 |
def build_kernel() -> AgentKernel:
|
| 80 |
+
"""Build and configure the distributed 22-space Agent Kernel."""
|
| 81 |
kernel = AgentKernel(ws_manager=ws_manager, ai_router=ai_router)
|
| 82 |
+
for space_name, space_instance in build_all_spaces(ws_manager=ws_manager, ai_router=ai_router).items():
|
| 83 |
+
kernel.register_space(space_name, space_instance)
|
| 84 |
+
log.info("🧠 GOD AGENT OS distributed kernel initialized", spaces=len(SPACE_CATALOG))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
return kernel
|
| 86 |
|
| 87 |
|
|
|
|
| 115 |
|
| 116 |
@asynccontextmanager
|
| 117 |
async def lifespan(app: FastAPI):
|
| 118 |
+
log.info("🚀 Starting GOD AGENT OS v10 — Distributed 22-Space Architecture...")
|
| 119 |
await init_db()
|
| 120 |
await task_engine.start()
|
| 121 |
asyncio.create_task(ws_manager.heartbeat_loop())
|
| 122 |
stats = ai_router.get_stats()
|
| 123 |
active = [name for name, s in stats.items() if s["available"]]
|
| 124 |
+
log.info("✅ GOD AGENT v10 — 22 Spaces + 16 Legacy Agents online")
|
| 125 |
log.info(f"🔑 Active AI providers: {active}")
|
| 126 |
log.info("🌐 Routing: SambaNova → Gemini → OpenAI → Groq → Cerebras")
|
| 127 |
+
log.info("📦 Spaces: distributed 22-space runtime online")
|
| 128 |
yield
|
| 129 |
log.info("🛑 Shutting down GOD AGENT OS v9...")
|
| 130 |
await task_engine.stop()
|
| 131 |
|
| 132 |
|
| 133 |
app = FastAPI(
|
| 134 |
+
title="🤖 GOD AGENT OS v10",
|
| 135 |
+
description="Distributed 22-Space Autonomous Agent OS | Powered by Pyae Sone",
|
| 136 |
+
version="10.0.0",
|
| 137 |
lifespan=lifespan,
|
| 138 |
docs_url="/api/docs",
|
| 139 |
redoc_url="/api/redoc",
|
|
|
|
| 387 |
stats = ai_router.get_stats()
|
| 388 |
active_providers = [name for name, s in stats.items() if s["available"]]
|
| 389 |
return {
|
| 390 |
+
"name": "🤖 GOD AGENT OS v10",
|
| 391 |
+
"version": "10.0.0",
|
| 392 |
"status": "operational",
|
| 393 |
"mode": "general_autonomous_agent_os",
|
| 394 |
+
"description": "Distributed 22-Space Architecture | Powered by Pyae Sone",
|
| 395 |
+
"architecture": "Distributed Worker Space Paradigm",
|
| 396 |
"spaces": kernel_status_data["spaces"],
|
| 397 |
"total_spaces": kernel_status_data["total_spaces"],
|
| 398 |
"ai_providers": active_providers,
|
| 399 |
"connectors": {"connected": cs["connected"], "total": cs["total"]},
|
| 400 |
"docs": "/api/docs",
|
| 401 |
"v9_features": [
|
| 402 |
+
"📦 22 distributed worker spaces across cognition, execution, verification, deployment, memory, coordination, monitoring, session, and infrastructure layers",
|
| 403 |
"🎭 5 Cognitive Roles: Cognition | Automation | Execution | Repair | Visual Intelligence",
|
| 404 |
+
"🧠 God Core Space orchestrates the worker fleet",
|
| 405 |
+
"🔑 KeyPool multi-key management (Gemini + SambaNova + GitHub)",
|
| 406 |
+
"🔄 Automatic worker-space routing based on intent",
|
| 407 |
+
"💾 Context Manager for session-scoped runtime state",
|
| 408 |
+
"⚡ Backward compatible with v8/v9 agent fleet",
|
| 409 |
"🌐 Real-time streaming via WebSocket",
|
| 410 |
],
|
| 411 |
}
|
backend/memory/__pycache__/__init__.cpython-312.pyc
DELETED
|
Binary file (146 Bytes)
|
|
|
backend/memory/__pycache__/db.cpython-312.pyc
DELETED
|
Binary file (19.5 kB)
|
|
|
backend/spaces/__init__.py
CHANGED
|
@@ -1,21 +1,19 @@
|
|
| 1 |
from .base_space import BaseSpace
|
| 2 |
-
from .
|
| 3 |
-
from .
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
| 10 |
|
| 11 |
__all__ = [
|
| 12 |
"BaseSpace",
|
| 13 |
-
"
|
| 14 |
-
"
|
| 15 |
-
"
|
| 16 |
-
"
|
| 17 |
-
"VisionSpace",
|
| 18 |
-
"DebugSpace",
|
| 19 |
-
"DeploySpace",
|
| 20 |
-
"CommunicationSpace",
|
| 21 |
]
|
|
|
|
| 1 |
from .base_space import BaseSpace
|
| 2 |
+
from .catalog import SPACE_CATALOG, SPACE_INDEX
|
| 3 |
+
from .worker_space import WorkerSpace
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def build_all_spaces(ws_manager=None, ai_router=None):
|
| 7 |
+
return {
|
| 8 |
+
spec["id"]: WorkerSpace(spec=spec, ws_manager=ws_manager, ai_router=ai_router)
|
| 9 |
+
for spec in SPACE_CATALOG
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
|
| 13 |
__all__ = [
|
| 14 |
"BaseSpace",
|
| 15 |
+
"WorkerSpace",
|
| 16 |
+
"SPACE_CATALOG",
|
| 17 |
+
"SPACE_INDEX",
|
| 18 |
+
"build_all_spaces",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
]
|
backend/spaces/catalog.py
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
SPACE_CATALOG = [
|
| 4 |
+
{
|
| 5 |
+
"id": "god-core-space",
|
| 6 |
+
"name": "God Core Space",
|
| 7 |
+
"icon": "🧠",
|
| 8 |
+
"color": "#7c3aed",
|
| 9 |
+
"layer": "Core Cognitive Layer",
|
| 10 |
+
"description": "System brain for orchestration, planning, reasoning, workflow control, mission state, websocket events, and model routing.",
|
| 11 |
+
"responsibilities": ["orchestrator", "planner", "reasoning", "task graph", "workflow engine", "mission state", "memory routing", "websocket events", "llm routing"],
|
| 12 |
+
"roles": ["cognition", "automation"],
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"id": "coding-worker-space",
|
| 16 |
+
"name": "Coding Worker Space",
|
| 17 |
+
"icon": "🔧",
|
| 18 |
+
"color": "#f59e0b",
|
| 19 |
+
"layer": "Execution Layer",
|
| 20 |
+
"description": "Code generation, file editing, refactoring, dependency handling, and code transformations.",
|
| 21 |
+
"responsibilities": ["code generation", "file editing", "refactoring", "dependency handling", "code transformations"],
|
| 22 |
+
"roles": ["execution", "cognition", "automation"],
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"id": "sandbox-worker-space",
|
| 26 |
+
"name": "Sandbox Worker Space",
|
| 27 |
+
"icon": "🧪",
|
| 28 |
+
"color": "#10b981",
|
| 29 |
+
"layer": "Execution Layer",
|
| 30 |
+
"description": "Isolated execution, runtime sandboxing, subprocesses, environment resets, and lifecycle management.",
|
| 31 |
+
"responsibilities": ["isolated execution", "docker runtime", "subprocesses", "environment resets", "runtime lifecycle"],
|
| 32 |
+
"roles": ["execution", "repair"],
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"id": "terminal-worker-space",
|
| 36 |
+
"name": "Terminal Worker Space",
|
| 37 |
+
"icon": "⌨️",
|
| 38 |
+
"color": "#14b8a6",
|
| 39 |
+
"layer": "Execution Layer",
|
| 40 |
+
"description": "Shell commands, package installs, build tools, and process monitoring.",
|
| 41 |
+
"responsibilities": ["shell commands", "package installs", "build tools", "process monitoring"],
|
| 42 |
+
"roles": ["execution", "automation"],
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"id": "filesystem-worker-space",
|
| 46 |
+
"name": "Filesystem Worker Space",
|
| 47 |
+
"icon": "🗂️",
|
| 48 |
+
"color": "#22c55e",
|
| 49 |
+
"layer": "Execution Layer",
|
| 50 |
+
"description": "File writes, project trees, artifact management, and storage operations.",
|
| 51 |
+
"responsibilities": ["file writes", "project trees", "artifact management", "storage operations"],
|
| 52 |
+
"roles": ["execution", "automation"],
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"id": "browser-worker-space",
|
| 56 |
+
"name": "Browser Worker Space",
|
| 57 |
+
"icon": "🌐",
|
| 58 |
+
"color": "#3b82f6",
|
| 59 |
+
"layer": "Browser + UI Intelligence",
|
| 60 |
+
"description": "Playwright automation, navigation, screenshots, and interaction testing.",
|
| 61 |
+
"responsibilities": ["playwright", "browser automation", "navigation", "screenshots", "interaction testing"],
|
| 62 |
+
"roles": ["automation", "cognition"],
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"id": "vision-worker-space",
|
| 66 |
+
"name": "Vision Worker Space",
|
| 67 |
+
"icon": "👁️",
|
| 68 |
+
"color": "#ec4899",
|
| 69 |
+
"layer": "Browser + UI Intelligence",
|
| 70 |
+
"description": "Screenshot analysis, OCR, layout detection, visual regression, and UI understanding.",
|
| 71 |
+
"responsibilities": ["screenshot analysis", "ocr", "layout detection", "visual regression", "ui understanding"],
|
| 72 |
+
"roles": ["visual_intelligence", "cognition"],
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"id": "ui-worker-space",
|
| 76 |
+
"name": "UI Worker Space",
|
| 77 |
+
"icon": "🎨",
|
| 78 |
+
"color": "#8b5cf6",
|
| 79 |
+
"layer": "Browser + UI Intelligence",
|
| 80 |
+
"description": "Frontend generation, design systems, responsive layouts, component consistency, and visual polish.",
|
| 81 |
+
"responsibilities": ["frontend generation", "design systems", "responsive layouts", "component consistency", "visual polish"],
|
| 82 |
+
"roles": ["visual_intelligence", "execution"],
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"id": "debug-worker-space",
|
| 86 |
+
"name": "Debug Worker Space",
|
| 87 |
+
"icon": "🐛",
|
| 88 |
+
"color": "#ef4444",
|
| 89 |
+
"layer": "Verification + Repair Layer",
|
| 90 |
+
"description": "Error analysis, traceback parsing, repair strategies, and retry planning.",
|
| 91 |
+
"responsibilities": ["error analysis", "traceback parsing", "repair strategies", "retry planning"],
|
| 92 |
+
"roles": ["repair", "cognition"],
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"id": "test-worker-space",
|
| 96 |
+
"name": "Test Worker Space",
|
| 97 |
+
"icon": "🧪",
|
| 98 |
+
"color": "#06b6d4",
|
| 99 |
+
"layer": "Verification + Repair Layer",
|
| 100 |
+
"description": "Run tests, assertions, integration checks, and regression testing.",
|
| 101 |
+
"responsibilities": ["run tests", "assertions", "integration checks", "regression testing"],
|
| 102 |
+
"roles": ["execution", "repair"],
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"id": "verification-worker-space",
|
| 106 |
+
"name": "Verification Worker Space",
|
| 107 |
+
"icon": "✅",
|
| 108 |
+
"color": "#84cc16",
|
| 109 |
+
"layer": "Verification + Repair Layer",
|
| 110 |
+
"description": "Validate outputs, compare expectations, quality scoring, and mission verification.",
|
| 111 |
+
"responsibilities": ["validate outputs", "compare expectations", "quality scoring", "mission verification"],
|
| 112 |
+
"roles": ["repair", "cognition"],
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"id": "git-worker-space",
|
| 116 |
+
"name": "Git Worker Space",
|
| 117 |
+
"icon": "🌳",
|
| 118 |
+
"color": "#f97316",
|
| 119 |
+
"layer": "Deployment Layer",
|
| 120 |
+
"description": "Commits, branching, diffs, merges, and repository workflow operations.",
|
| 121 |
+
"responsibilities": ["commits", "branching", "diffs", "merges"],
|
| 122 |
+
"roles": ["automation", "execution"],
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"id": "deploy-worker-space",
|
| 126 |
+
"name": "Deploy Worker Space",
|
| 127 |
+
"icon": "🚀",
|
| 128 |
+
"color": "#0ea5e9",
|
| 129 |
+
"layer": "Deployment Layer",
|
| 130 |
+
"description": "Vercel, Railway, Docker deploys, preview URLs, and CI/CD triggers.",
|
| 131 |
+
"responsibilities": ["vercel deploy", "railway deploy", "docker deploy", "preview urls", "ci/cd triggers"],
|
| 132 |
+
"roles": ["automation", "execution"],
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"id": "connector-worker-space",
|
| 136 |
+
"name": "Connector Worker Space",
|
| 137 |
+
"icon": "🔌",
|
| 138 |
+
"color": "#6366f1",
|
| 139 |
+
"layer": "Deployment Layer",
|
| 140 |
+
"description": "GitHub, Supabase, APIs, and external integrations.",
|
| 141 |
+
"responsibilities": ["github", "supabase", "apis", "external integrations"],
|
| 142 |
+
"roles": ["automation", "cognition"],
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"id": "memory-worker-space",
|
| 146 |
+
"name": "Memory Worker Space",
|
| 147 |
+
"icon": "🧠",
|
| 148 |
+
"color": "#a855f7",
|
| 149 |
+
"layer": "Memory + Knowledge Layer",
|
| 150 |
+
"description": "Vector DB, execution history, learned fixes, project memory, and long-term state.",
|
| 151 |
+
"responsibilities": ["vector db", "execution history", "learned fixes", "project memory", "long-term state"],
|
| 152 |
+
"roles": ["cognition", "automation"],
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"id": "knowledge-worker-space",
|
| 156 |
+
"name": "Knowledge Worker Space",
|
| 157 |
+
"icon": "📚",
|
| 158 |
+
"color": "#4f46e5",
|
| 159 |
+
"layer": "Memory + Knowledge Layer",
|
| 160 |
+
"description": "Docs retrieval, semantic search, RAG pipelines, and indexed repositories.",
|
| 161 |
+
"responsibilities": ["docs retrieval", "semantic search", "rag pipelines", "indexed repositories"],
|
| 162 |
+
"roles": ["cognition", "automation"],
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"id": "workflow-worker-space",
|
| 166 |
+
"name": "Workflow Worker Space",
|
| 167 |
+
"icon": "🧭",
|
| 168 |
+
"color": "#0f766e",
|
| 169 |
+
"layer": "Coordination Layer",
|
| 170 |
+
"description": "DAG execution, task queues, retries, scheduling, and background jobs.",
|
| 171 |
+
"responsibilities": ["dag execution", "task queues", "retries", "scheduling", "background jobs"],
|
| 172 |
+
"roles": ["automation", "execution"],
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"id": "eventbus-space",
|
| 176 |
+
"name": "Eventbus Space",
|
| 177 |
+
"icon": "📡",
|
| 178 |
+
"color": "#06b6d4",
|
| 179 |
+
"layer": "Coordination Layer",
|
| 180 |
+
"description": "Redis PubSub, NATS, RabbitMQ, and event streams.",
|
| 181 |
+
"responsibilities": ["redis pubsub", "nats", "rabbitmq", "event streams"],
|
| 182 |
+
"roles": ["automation", "execution"],
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"id": "observability-space",
|
| 186 |
+
"name": "Observability Space",
|
| 187 |
+
"icon": "📈",
|
| 188 |
+
"color": "#22c55e",
|
| 189 |
+
"layer": "Monitoring Layer",
|
| 190 |
+
"description": "Logs, metrics, tracing, agent monitoring, and runtime analytics.",
|
| 191 |
+
"responsibilities": ["logs", "metrics", "tracing", "agent monitoring", "runtime analytics"],
|
| 192 |
+
"roles": ["cognition", "automation"],
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"id": "session-runtime-space",
|
| 196 |
+
"name": "Session Runtime Space",
|
| 197 |
+
"icon": "🧷",
|
| 198 |
+
"color": "#64748b",
|
| 199 |
+
"layer": "Session Layer",
|
| 200 |
+
"description": "User sessions, mission isolation, runtime persistence, and checkpointing.",
|
| 201 |
+
"responsibilities": ["user sessions", "mission isolation", "runtime persistence", "checkpointing"],
|
| 202 |
+
"roles": ["automation", "cognition"],
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"id": "model-router-space",
|
| 206 |
+
"name": "Model Router Space",
|
| 207 |
+
"icon": "🛣️",
|
| 208 |
+
"color": "#eab308",
|
| 209 |
+
"layer": "Infrastructure Layer",
|
| 210 |
+
"description": "GPT routing, Claude routing, fallback models, cost optimization, and model selection.",
|
| 211 |
+
"responsibilities": ["gpt routing", "claude routing", "fallback models", "cost optimization", "model selection"],
|
| 212 |
+
"roles": ["cognition", "automation"],
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"id": "auth-gateway-space",
|
| 216 |
+
"name": "Auth Gateway Space",
|
| 217 |
+
"icon": "🔐",
|
| 218 |
+
"color": "#9333ea",
|
| 219 |
+
"layer": "Infrastructure Layer",
|
| 220 |
+
"description": "Auth, API keys, rate limits, and permissions.",
|
| 221 |
+
"responsibilities": ["auth", "api keys", "rate limits", "permissions"],
|
| 222 |
+
"roles": ["automation", "repair"],
|
| 223 |
+
},
|
| 224 |
+
]
|
| 225 |
+
|
| 226 |
+
SPACE_INDEX = {item["id"]: item for item in SPACE_CATALOG}
|
backend/spaces/worker_space.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import Any, Dict, List
|
| 4 |
+
import structlog
|
| 5 |
+
|
| 6 |
+
from .base_space import BaseSpace
|
| 7 |
+
|
| 8 |
+
log = structlog.get_logger()
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class WorkerSpace(BaseSpace):
|
| 12 |
+
available_roles = ["cognition", "automation", "execution", "repair", "visual_intelligence"]
|
| 13 |
+
|
| 14 |
+
def __init__(self, spec: Dict[str, Any], ws_manager=None, ai_router=None):
|
| 15 |
+
self.spec = spec
|
| 16 |
+
self.space_name = spec["id"]
|
| 17 |
+
self.space_description = spec["description"]
|
| 18 |
+
self.available_roles = spec.get("roles", self.available_roles)
|
| 19 |
+
super().__init__(ws_manager, ai_router)
|
| 20 |
+
self._register_default_tools()
|
| 21 |
+
|
| 22 |
+
def _register_default_tools(self):
|
| 23 |
+
for responsibility in self.spec.get("responsibilities", []):
|
| 24 |
+
tool_name = responsibility.lower().replace(" ", "_").replace("/", "_")
|
| 25 |
+
self.register_tool(tool_name, self._generic_tool, responsibility)
|
| 26 |
+
|
| 27 |
+
async def _generic_tool(self, **kwargs) -> str:
|
| 28 |
+
return f"{self.spec['name']} executed with {kwargs}"
|
| 29 |
+
|
| 30 |
+
def _build_specialized_prompt(self, role: str, task: str, context: Dict[str, Any]) -> str:
|
| 31 |
+
responsibilities = ", ".join(self.spec.get("responsibilities", []))
|
| 32 |
+
layer = self.spec.get("layer", "")
|
| 33 |
+
return f"""You are {self.spec['name']} inside GOD AGENT OS v10.
|
| 34 |
+
|
| 35 |
+
Layer: {layer}
|
| 36 |
+
Space ID: {self.spec['id']}
|
| 37 |
+
Description: {self.spec['description']}
|
| 38 |
+
Responsibilities: {responsibilities}
|
| 39 |
+
Active Role: {role}
|
| 40 |
+
|
| 41 |
+
Rules:
|
| 42 |
+
- Stay inside this space's domain responsibilities.
|
| 43 |
+
- Produce concrete, production-ready output.
|
| 44 |
+
- When a task spans multiple domains, explain how this space contributes and what should happen next.
|
| 45 |
+
- Prefer structured bullets for plans, commands, patches, interfaces, contracts, and validation criteria.
|
| 46 |
+
- Be concise but specific.
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
async def execute(self, task: str, role: str, session_id: str, context: Dict = None) -> str:
|
| 50 |
+
context = context or {}
|
| 51 |
+
await self.stream_update(session_id, f"{self.spec['icon']} {self.spec['name']} activated — {role} role", space=self.space_name)
|
| 52 |
+
|
| 53 |
+
if not self.ai_router:
|
| 54 |
+
responsibilities = "\n".join(f"- {item}" for item in self.spec.get("responsibilities", []))
|
| 55 |
+
return f"{self.spec['name']} is offline.\n\nResponsibilities:\n{responsibilities}"
|
| 56 |
+
|
| 57 |
+
system_prompt = self._build_specialized_prompt(role, task, context)
|
| 58 |
+
try:
|
| 59 |
+
response = await self.ai_router.complete(prompt=task, system=system_prompt, max_tokens=2048)
|
| 60 |
+
if isinstance(response, dict):
|
| 61 |
+
return response.get("content", "") or f"{self.spec['name']} completed the task."
|
| 62 |
+
return str(response)
|
| 63 |
+
except Exception as exc:
|
| 64 |
+
log.error("worker_space_execute_failed", space=self.space_name, error=str(exc))
|
| 65 |
+
responsibilities = ", ".join(self.spec.get("responsibilities", []))
|
| 66 |
+
return (
|
| 67 |
+
f"{self.spec['name']} error: {exc}\n\n"
|
| 68 |
+
f"Primary responsibilities: {responsibilities}"
|
| 69 |
+
)
|
backend/worker_spaces/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
WORKER_SPACES = ['god-core-space', 'coding-worker-space', 'sandbox-worker-space', 'terminal-worker-space', 'filesystem-worker-space', 'browser-worker-space', 'vision-worker-space', 'ui-worker-space', 'debug-worker-space', 'test-worker-space', 'verification-worker-space', 'git-worker-space', 'deploy-worker-space', 'connector-worker-space', 'memory-worker-space', 'knowledge-worker-space', 'workflow-worker-space', 'eventbus-space', 'observability-space', 'session-runtime-space', 'model-router-space', 'auth-gateway-space']
|
backend/worker_spaces/auth_gateway_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'auth-gateway-space'
|
backend/worker_spaces/auth_gateway_space/spec.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "auth-gateway-space",
|
| 3 |
+
"name": "Auth Gateway Space",
|
| 4 |
+
"icon": "🔐",
|
| 5 |
+
"color": "#9333ea",
|
| 6 |
+
"layer": "Infrastructure Layer",
|
| 7 |
+
"description": "Auth, API keys, rate limits, and permissions.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"auth",
|
| 10 |
+
"api keys",
|
| 11 |
+
"rate limits",
|
| 12 |
+
"permissions"
|
| 13 |
+
],
|
| 14 |
+
"roles": [
|
| 15 |
+
"automation",
|
| 16 |
+
"repair"
|
| 17 |
+
]
|
| 18 |
+
}
|
backend/worker_spaces/browser_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'browser-worker-space'
|
backend/worker_spaces/browser_worker_space/spec.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "browser-worker-space",
|
| 3 |
+
"name": "Browser Worker Space",
|
| 4 |
+
"icon": "🌐",
|
| 5 |
+
"color": "#3b82f6",
|
| 6 |
+
"layer": "Browser + UI Intelligence",
|
| 7 |
+
"description": "Playwright automation, navigation, screenshots, and interaction testing.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"playwright",
|
| 10 |
+
"browser automation",
|
| 11 |
+
"navigation",
|
| 12 |
+
"screenshots",
|
| 13 |
+
"interaction testing"
|
| 14 |
+
],
|
| 15 |
+
"roles": [
|
| 16 |
+
"automation",
|
| 17 |
+
"cognition"
|
| 18 |
+
]
|
| 19 |
+
}
|
backend/worker_spaces/coding_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'coding-worker-space'
|
backend/worker_spaces/coding_worker_space/spec.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "coding-worker-space",
|
| 3 |
+
"name": "Coding Worker Space",
|
| 4 |
+
"icon": "🔧",
|
| 5 |
+
"color": "#f59e0b",
|
| 6 |
+
"layer": "Execution Layer",
|
| 7 |
+
"description": "Code generation, file editing, refactoring, dependency handling, and code transformations.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"code generation",
|
| 10 |
+
"file editing",
|
| 11 |
+
"refactoring",
|
| 12 |
+
"dependency handling",
|
| 13 |
+
"code transformations"
|
| 14 |
+
],
|
| 15 |
+
"roles": [
|
| 16 |
+
"execution",
|
| 17 |
+
"cognition",
|
| 18 |
+
"automation"
|
| 19 |
+
]
|
| 20 |
+
}
|
backend/worker_spaces/connector_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'connector-worker-space'
|
backend/worker_spaces/connector_worker_space/spec.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "connector-worker-space",
|
| 3 |
+
"name": "Connector Worker Space",
|
| 4 |
+
"icon": "🔌",
|
| 5 |
+
"color": "#6366f1",
|
| 6 |
+
"layer": "Deployment Layer",
|
| 7 |
+
"description": "GitHub, Supabase, APIs, and external integrations.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"github",
|
| 10 |
+
"supabase",
|
| 11 |
+
"apis",
|
| 12 |
+
"external integrations"
|
| 13 |
+
],
|
| 14 |
+
"roles": [
|
| 15 |
+
"automation",
|
| 16 |
+
"cognition"
|
| 17 |
+
]
|
| 18 |
+
}
|
backend/worker_spaces/debug_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'debug-worker-space'
|
backend/worker_spaces/debug_worker_space/spec.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "debug-worker-space",
|
| 3 |
+
"name": "Debug Worker Space",
|
| 4 |
+
"icon": "🐛",
|
| 5 |
+
"color": "#ef4444",
|
| 6 |
+
"layer": "Verification + Repair Layer",
|
| 7 |
+
"description": "Error analysis, traceback parsing, repair strategies, and retry planning.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"error analysis",
|
| 10 |
+
"traceback parsing",
|
| 11 |
+
"repair strategies",
|
| 12 |
+
"retry planning"
|
| 13 |
+
],
|
| 14 |
+
"roles": [
|
| 15 |
+
"repair",
|
| 16 |
+
"cognition"
|
| 17 |
+
]
|
| 18 |
+
}
|
backend/worker_spaces/deploy_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'deploy-worker-space'
|
backend/worker_spaces/deploy_worker_space/spec.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "deploy-worker-space",
|
| 3 |
+
"name": "Deploy Worker Space",
|
| 4 |
+
"icon": "🚀",
|
| 5 |
+
"color": "#0ea5e9",
|
| 6 |
+
"layer": "Deployment Layer",
|
| 7 |
+
"description": "Vercel, Railway, Docker deploys, preview URLs, and CI/CD triggers.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"vercel deploy",
|
| 10 |
+
"railway deploy",
|
| 11 |
+
"docker deploy",
|
| 12 |
+
"preview urls",
|
| 13 |
+
"ci/cd triggers"
|
| 14 |
+
],
|
| 15 |
+
"roles": [
|
| 16 |
+
"automation",
|
| 17 |
+
"execution"
|
| 18 |
+
]
|
| 19 |
+
}
|
backend/worker_spaces/eventbus_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'eventbus-space'
|
backend/worker_spaces/eventbus_space/spec.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "eventbus-space",
|
| 3 |
+
"name": "Eventbus Space",
|
| 4 |
+
"icon": "📡",
|
| 5 |
+
"color": "#06b6d4",
|
| 6 |
+
"layer": "Coordination Layer",
|
| 7 |
+
"description": "Redis PubSub, NATS, RabbitMQ, and event streams.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"redis pubsub",
|
| 10 |
+
"nats",
|
| 11 |
+
"rabbitmq",
|
| 12 |
+
"event streams"
|
| 13 |
+
],
|
| 14 |
+
"roles": [
|
| 15 |
+
"automation",
|
| 16 |
+
"execution"
|
| 17 |
+
]
|
| 18 |
+
}
|
backend/worker_spaces/filesystem_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'filesystem-worker-space'
|
backend/worker_spaces/filesystem_worker_space/spec.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "filesystem-worker-space",
|
| 3 |
+
"name": "Filesystem Worker Space",
|
| 4 |
+
"icon": "🗂️",
|
| 5 |
+
"color": "#22c55e",
|
| 6 |
+
"layer": "Execution Layer",
|
| 7 |
+
"description": "File writes, project trees, artifact management, and storage operations.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"file writes",
|
| 10 |
+
"project trees",
|
| 11 |
+
"artifact management",
|
| 12 |
+
"storage operations"
|
| 13 |
+
],
|
| 14 |
+
"roles": [
|
| 15 |
+
"execution",
|
| 16 |
+
"automation"
|
| 17 |
+
]
|
| 18 |
+
}
|
backend/worker_spaces/git_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'git-worker-space'
|
backend/worker_spaces/git_worker_space/spec.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "git-worker-space",
|
| 3 |
+
"name": "Git Worker Space",
|
| 4 |
+
"icon": "🌳",
|
| 5 |
+
"color": "#f97316",
|
| 6 |
+
"layer": "Deployment Layer",
|
| 7 |
+
"description": "Commits, branching, diffs, merges, and repository workflow operations.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"commits",
|
| 10 |
+
"branching",
|
| 11 |
+
"diffs",
|
| 12 |
+
"merges"
|
| 13 |
+
],
|
| 14 |
+
"roles": [
|
| 15 |
+
"automation",
|
| 16 |
+
"execution"
|
| 17 |
+
]
|
| 18 |
+
}
|
backend/worker_spaces/god_core_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'god-core-space'
|
backend/worker_spaces/god_core_space/spec.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "god-core-space",
|
| 3 |
+
"name": "God Core Space",
|
| 4 |
+
"icon": "🧠",
|
| 5 |
+
"color": "#7c3aed",
|
| 6 |
+
"layer": "Core Cognitive Layer",
|
| 7 |
+
"description": "System brain for orchestration, planning, reasoning, workflow control, mission state, websocket events, and model routing.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"orchestrator",
|
| 10 |
+
"planner",
|
| 11 |
+
"reasoning",
|
| 12 |
+
"task graph",
|
| 13 |
+
"workflow engine",
|
| 14 |
+
"mission state",
|
| 15 |
+
"memory routing",
|
| 16 |
+
"websocket events",
|
| 17 |
+
"llm routing"
|
| 18 |
+
],
|
| 19 |
+
"roles": [
|
| 20 |
+
"cognition",
|
| 21 |
+
"automation"
|
| 22 |
+
]
|
| 23 |
+
}
|
backend/worker_spaces/knowledge_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'knowledge-worker-space'
|
backend/worker_spaces/knowledge_worker_space/spec.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "knowledge-worker-space",
|
| 3 |
+
"name": "Knowledge Worker Space",
|
| 4 |
+
"icon": "📚",
|
| 5 |
+
"color": "#4f46e5",
|
| 6 |
+
"layer": "Memory + Knowledge Layer",
|
| 7 |
+
"description": "Docs retrieval, semantic search, RAG pipelines, and indexed repositories.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"docs retrieval",
|
| 10 |
+
"semantic search",
|
| 11 |
+
"rag pipelines",
|
| 12 |
+
"indexed repositories"
|
| 13 |
+
],
|
| 14 |
+
"roles": [
|
| 15 |
+
"cognition",
|
| 16 |
+
"automation"
|
| 17 |
+
]
|
| 18 |
+
}
|
backend/worker_spaces/memory_worker_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'memory-worker-space'
|
backend/worker_spaces/memory_worker_space/spec.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "memory-worker-space",
|
| 3 |
+
"name": "Memory Worker Space",
|
| 4 |
+
"icon": "🧠",
|
| 5 |
+
"color": "#a855f7",
|
| 6 |
+
"layer": "Memory + Knowledge Layer",
|
| 7 |
+
"description": "Vector DB, execution history, learned fixes, project memory, and long-term state.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"vector db",
|
| 10 |
+
"execution history",
|
| 11 |
+
"learned fixes",
|
| 12 |
+
"project memory",
|
| 13 |
+
"long-term state"
|
| 14 |
+
],
|
| 15 |
+
"roles": [
|
| 16 |
+
"cognition",
|
| 17 |
+
"automation"
|
| 18 |
+
]
|
| 19 |
+
}
|
backend/worker_spaces/model_router_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'model-router-space'
|
backend/worker_spaces/model_router_space/spec.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "model-router-space",
|
| 3 |
+
"name": "Model Router Space",
|
| 4 |
+
"icon": "🛣️",
|
| 5 |
+
"color": "#eab308",
|
| 6 |
+
"layer": "Infrastructure Layer",
|
| 7 |
+
"description": "GPT routing, Claude routing, fallback models, cost optimization, and model selection.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"gpt routing",
|
| 10 |
+
"claude routing",
|
| 11 |
+
"fallback models",
|
| 12 |
+
"cost optimization",
|
| 13 |
+
"model selection"
|
| 14 |
+
],
|
| 15 |
+
"roles": [
|
| 16 |
+
"cognition",
|
| 17 |
+
"automation"
|
| 18 |
+
]
|
| 19 |
+
}
|
backend/worker_spaces/observability_space/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
SPACE_ID = 'observability-space'
|
backend/worker_spaces/observability_space/spec.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SPACE_SPEC = {
|
| 2 |
+
"id": "observability-space",
|
| 3 |
+
"name": "Observability Space",
|
| 4 |
+
"icon": "📈",
|
| 5 |
+
"color": "#22c55e",
|
| 6 |
+
"layer": "Monitoring Layer",
|
| 7 |
+
"description": "Logs, metrics, tracing, agent monitoring, and runtime analytics.",
|
| 8 |
+
"responsibilities": [
|
| 9 |
+
"logs",
|
| 10 |
+
"metrics",
|
| 11 |
+
"tracing",
|
| 12 |
+
"agent monitoring",
|
| 13 |
+
"runtime analytics"
|
| 14 |
+
],
|
| 15 |
+
"roles": [
|
| 16 |
+
"cognition",
|
| 17 |
+
"automation"
|
| 18 |
+
]
|
| 19 |
+
}
|