File size: 12,921 Bytes
6929073 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | # Agent OS - Documentacao Tecnica
## Visao Geral
Agent OS e um sistema operacional de agentes IA. Uma interface desktop-like (macOS-style) que orquestra multiplos modelos de IA especializados atraves de um modelo gestor central. Cada agente e um "slot" plugavel que pode ser trocado, adicionado ou removido facilmente.
## Arquitetura
```
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AGENT OS (Frontend React) β
β βββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββ¬βββββββββ¬ββββββββ β
β β Browser β Terminal β Inbox βMission β Agents βFinder β β
β β β β βControl β β β β
β βββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββ΄βββββββββ΄ββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β SERVER (Node.js + Express) β
β ββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬ββββββββββββββ β
β β Browser β PM2 β Supabase β GitHub β SmolAgent β β
β β Manager β API β API β CLI β Daemon β β
β ββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄ββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β CAMADA DE ORQUESTRACAO β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MODELO GESTOR (Orchestrator) β β
β β Recebe tarefa β Classifica β Roteia β Retorna β β
β β Llama 3.3 70B via HF Inference API (gratis, Pro) β β
β βββββββββββββββ¬βββββββββββββ¬ββββββββββββββββ¬ββββββββββββββββ β
β β β β β
β βββββββββββββββ΄β βββββββββ΄βββββββ βββββββ΄βββββββββββββββ β
β β Agent Slot 1 β β Agent Slot 2 β β Agent Slot N β β
β β Coding β β SQL/Data β β (plugavel) β β
β β Opus 4.6 API β β 1.5B local β β qualquer modelo β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β MEMORIA CENTRAL β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Basic Memory (MCP Server) β β
β β Markdown files + SQLite + Vector Embeddings β β
β β Persistente entre sessoes e agentes β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
## Stack Atual
### Frontend (React + TypeScript + Vite)
- **Desktop**: Interface macOS-style com janelas arrastΓ‘veis, dock, menu bar
- **Window Manager**: Zustand store (`useAppStore`) com persist
- **Apps**: Registry plugavel (`appRegistry.ts`)
- **Componentes**: Desktop, Dock, MenuBar, WindowFrame
### Backend (Node.js + Express)
- **Porta**: 3000
- **APIs implementadas**:
- `/api/browsers/*` - Browser automation via Playwright (criar, navegar, clicar, digitar, screenshot)
- `/api/pm2/*` - Process manager (listar, restart, stop, logs)
- `/api/supabase/*` - Supabase CLI proxy (auth, projetos, tabelas, SQL)
- `/api/github/*` - GitHub CLI proxy (auth, repos, issues, PRs, notificacoes)
- `/api/smol/chat` - SmolAgent daemon proxy (porta 8082)
- `/api/launcher/*` - Proxy pro claude-launcher-web (porta 3002)
- `/ws` - WebSocket para terminal, browser streaming, file watching
### Infra (Vultr - 207.246.65.100)
- **OS**: Ubuntu, 4 CPU, 8GB RAM, sem GPU
- **Processos ativos**:
- `server.js` (porta 3000) - Frontend + API
- `smol-daemon.py` (porta 8082) - SmolAgent backend
- `llama-server` (porta 8080) - Modelo 1.5B local CPU
- `launcher/server.js` (porta 3002) - Claude launcher
- `agent-bot` (porta 9090) - Bot auxiliar
## App Registry
O sistema de apps e plugavel. Cada app registrado no `appRegistry.ts`:
| App | ID | Status | Descricao |
|-----|----|--------|-----------|
| Browser | `browser` | Funcional | Web browser com Playwright |
| Terminal | `terminal` | Funcional | Terminal session via launcher |
| Inbox | `inbox` | Placeholder | Task inbox com comments |
| Mission Control | `mission-control` | Placeholder | Kanban board de tarefas |
| Agents | `agents` | Placeholder | Org chart de agentes |
| Finder | `finder` | Placeholder | File browser de workspaces |
| Settings | `settings` | Placeholder | Configuracoes do sistema |
### Interface de um App
```typescript
interface AppRegistryEntry {
id: string; // ID unico
name: string; // Nome exibido
icon: string; // Icone do dock
description: string; // Descricao
component: React.LazyExoticComponent; // Componente React
defaultSize: { width, height };
minSize?: { width, height };
allowMultiple?: boolean; // Multiplas instancias
dockPinned?: boolean; // Fixado no dock
}
```
## Agent Registry (A IMPLEMENTAR)
Sistema de registro de agentes especializados. Cada agente e um slot plugavel:
```typescript
interface AgentSlot {
id: string; // "coder", "sql", "text", "frontend"
name: string; // "Coding Agent"
description: string; // "Especializado em..."
provider: "anthropic" | "openai" | "openrouter" | "huggingface" | "local";
config: {
model: string; // "claude-opus-4-6" ou "agent-os-1b5"
endpoint?: string; // URL do endpoint (local ou API)
apiKey?: string; // Chave da API
temperature?: number;
maxTokens?: number;
};
capabilities: string[]; // ["code", "sql", "text", "reasoning"]
active: boolean; // Ativado/desativado
}
```
### Agentes Planejados
| Slot | Modelo | Provider | Funcao |
|------|--------|----------|--------|
| **Gestor/Orquestrador** | Llama 3.3 70B | HF Inference API (gratis Pro) | Roteia tarefas, classifica intencao, coordena agentes |
| **Coding** | Claude Opus 4.6 | Anthropic API | Escreve/refatora codigo |
| **SQL/Data** | agent-os-1b5 (custom) | Local llama-server | Queries SQL, Supabase, information_schema |
| **Frontend** | (a definir) | (a definir) | UI/UX, componentes React |
| **Texto** | (a definir) | (a definir) | Criacao de conteudo, copywriting |
| **Pesquisa** | (a definir) | (a definir) | Web search, analise de dados |
### Fluxo de Orquestracao
```
1. Usuario digita mensagem no chat
2. Gestor (Llama 70B) analisa a intencao:
- "escreve uma funcao que..." β routing: coder
- "quantas vms ativas..." β routing: sql
- "cria um texto sobre..." β routing: text
3. Gestor envia pra o agente especializado
4. Agente processa e retorna resultado
5. Gestor formata e entrega ao usuario
6. Memoria Central registra a interacao
```
### Troca de Agentes
O usuario pode a qualquer momento:
- Trocar o modelo de um slot (ex: mudar coder de Opus pra GPT-4)
- Adicionar novo slot
- Desativar um slot
- Escolher manualmente qual agente usar
## Memoria Central: Basic Memory
### O que e
Sistema de memoria persistente baseado em Markdown + SQLite + Vector Embeddings. Opera como MCP Server.
### Arquitetura
```
ββββββββββββββββββββββββββββββββββββββββ
β Markdown Files β
β - YAML frontmatter (metadata) β
β - [category] observations β
β - [[wiki-links]] relations β
ββββββββββββββββββββββββββββββββββββββββ€
β SQLite Index β
β - Full-text search β
β - Vector embeddings (FastEmbed) β
β - Hybrid search β
ββββββββββββββββββββββββββββββββββββββββ€
β MCP Server β
β - memory:// URLs β
β - CRUD de notas β
β - Navegacao semantica β
β - Context building β
ββββββββββββββββββββββββββββββββββββββββ
```
### Uso no Agent OS
- **Contexto entre sessoes**: Agentes mantem conhecimento entre conversas
- **Knowledge graph**: Relacoes entre entidades (projetos, decisoes, aprendizados)
- **Multi-agente**: Todos os agentes leem/escrevem na mesma memoria
- **Orquestrador documenta**: O gestor registra cada interacao e decisao
- **Humano edita**: Usuario pode editar arquivos Markdown diretamente
### Claude Session Logger
Complementa o Basic Memory registrando automaticamente:
- Sessoes de conversa com Claude
- Ferramentas utilizadas
- Decisoes tomadas
- Erros e solucoes
## Modelos Treinados (Custom)
### agent-os-adapter-1.5b
- **Base**: Qwen 2.5 1.5B Instruct
- **Treino**: LoRA (r=32, alpha=64), 7 epochs, 415 exemplos x4
- **Funcao**: Converter linguagem natural β JSON (SQL, CLI, shell)
- **Deploy**: GGUF Q8 no llama-server (CPU, 1.6GB RAM, ~3s/query)
- **Repos**:
- Adapter: `devsomosahub/agent-os-adapter-1.5b`
- Merged: `devsomosahub/agent-os-1b5-merged`
### agent-os-adapter-7b
- **Base**: Qwen 2.5 7B Instruct
- **Treino**: LoRA Q4, mesma config
- **Funcao**: Mesma, mas mais preciso
- **Repos**:
- Adapter: `devsomosahub/agent-os-adapter-7b`
- Merged: `devsomosahub/agent-os-7b-merged`
### Limitacao conhecida
Modelos custom inventam nomes de colunas baseados no dataset de treino quando fazem queries diretas. Solucao: fluxo de 2 passos (information_schema primeiro, depois query com colunas reais).
## APIs Externas Utilizadas
| Servico | Uso | Autenticacao |
|---------|-----|-------------|
| HuggingFace (Pro) | Inference API gratis (Llama 70B), treinamento, endpoints | Token HF |
| Anthropic | Claude Opus 4.6 para coding agent | API Key |
| OpenRouter | LLMs alternativos, fallback | API Key |
| Vultr | Servidores (VMs dos boards, server Agent OS) | API Key |
| Supabase | Banco de dados dos projetos (Cloud-Hub, Hubia) | Access Token |
| GitHub | Repos, issues, PRs | gh CLI token |
## Portas do Server (207.246.65.100)
| Porta | Servico | Acesso |
|-------|---------|--------|
| 3000 | Agent OS (frontend + API) | Publico |
| 3002 | Claude Launcher Web | Interno |
| 8080 | llama-server (modelo 1.5B) | Interno |
| 8082 | SmolAgent daemon | Interno |
| 9090 | Agent bot | Interno |
## Proximos Passos
1. **Implementar Agent Registry** - Config JSON de agentes plugaveis
2. **Implementar Orquestrador** - Gestor que roteia entre agentes
3. **Integrar Basic Memory** - MCP Server como memoria central
4. **Integrar Session Logger** - Log automatico de sessoes
5. **Implementar apps Placeholder** - Inbox, Mission Control, Agents, Finder, Settings
6. **Modelo guia/assistente** - Treinar modelo que explica o sistema ao usuario
7. **Dashboard de agentes** - UI para ver/trocar/configurar agentes em tempo real
|