# SPEC-050 — Invest AI Agents (TradingAgents + OpenAlice) — paper-only

**SPEC-ID:** 050-MYVEXX  
**Vincula:** **049** (invest.myvexx.com / CT124), short [JY-ex4_3rjQ](https://www.youtube.com/shorts/JY-ex4_3rjQ)  
**Status:** 🚧 Fase 1–2 em curso (2026-07-24)  
**Para:** Roger  

## Objectivo

Integrar os dois stacks do TRADER Guide em modo **paper/research only** no CT124.

| Stack | Repo | Papel |
|-------|------|-------|
| TradingAgents | https://github.com/TauricResearch/TradingAgents | Pesquisa multi-agente |
| OpenAlice | https://github.com/TraderAlice/OpenAlice | Workspace + paper UTA (beta) |

## CT124 recursos

| Recurso | Valor |
|---------|-------|
| RAM | **8 GB** (subido de 2 GB) |
| Swap | **2 GB** |
| Path | `/opt/invest/agents/` |

## URLs públicas (Traefik CT120 → CT124)

| URL | Backend |
|-----|---------|
| `https://invest.myvexx.com/api/agents/health` | bridge `:3100` (strip `/api/agents`) |
| `https://invest.myvexx.com/api/agents/agents` | lista dos dois engines |
| `https://invest.myvexx.com/api/agents/research/run` | TradingAgents (precisa LLM key) |
| `https://openalice.myvexx.com/` | OpenAlice UI `:47331` (**usar este** — SPA na raiz) |
| `https://invest.myvexx.com/alice/` | Legacy path — **quebrado** (assets `/assets` caem no invest) |

## Segurança

- `ALLOW_LIVE_BROKER=0`
- Sem keys de brokerage live
- Alpaca só paper, se UTA for ligado
- Não é conselho financeiro

## Estado

| Item | Estado |
|------|--------|
| Clones | ✅ |
| Bridge `:3100` | ✅ |
| Traefik `/api/agents` + `/alice` | ✅ |
| CT124 RAM 8G | ✅ |
| TradingAgents image build | 🔄 |
| OpenAlice image build | 🔄 |
| LLM API key em `.env` | ❌ pendente (Roger) |
| OpenAlice Claude/Codex login | ❌ pendente após `docker compose up` |

## Pendente do operador

1. Preencher `/opt/invest/agents/TradingAgents/.env` com **uma** LLM key (`OPENAI_API_KEY` ou `ANTHROPIC_API_KEY`, etc.).
2. Após build OpenAlice: `cd /opt/invest/agents/OpenAlice && docker compose up -d`  
   depois `docker exec -it openalice claude` (OAuth).
3. Nunca colar keys live de brokers.

## Comandos

```bash
# Bridge
curl -s https://invest.myvexx.com/api/agents/health

# Research dry-run
curl -s -X POST https://invest.myvexx.com/api/agents/research/run \
  -H 'Content-Type: application/json' \
  -d '{"ticker":"NVDA","dry_run":true}'

# Builds
pct exec 124 -- tail -f /tmp/openalice-build.log
pct exec 124 -- tail -f /tmp/tradingagents-build.log
```

