# Agent Platform API — Spec 029 (completo)

**Prod:** `https://api.ops.ligbox.com.br/api/v1/agents`  
**Staging:** `http://10.10.10.122:8180/api/v1/agents`  
**Desk UI:** módulo `agentic-ops` · staging `:8192`

---

## GET /health

Público. Sem auth.

```json
{
  "status": "ok",
  "tier": "t1",
  "ollama": true,
  "ollama_url": "http://10.10.10.123:11434",
  "model": "qwen2.5:7b-instruct",
  "embed_model": "nomic-embed-text"
}
```

## GET /roster

Auth JWT. Lista A0–A7 + Vigia + Curador com acções e aprovação.

## GET /inbox

Auth JWT. Mensagens `requires_human=1` filtradas por role Desk.

## GET /threads · GET /threads/{id}/messages

Auth JWT. Conversas agente↔humano.

## POST /threads/{id}/reply

Body: `{"body": "...", "target_agent": "A6"}`

## POST /messages/{id}/ack

Arquiva item inbox.

## GET /scenarios · GET /findings · GET /action-log

Auth JWT. Painel operacional.

## POST /findings/{id}/ack

Marca finding visto.

## POST /runs/{scenario_id}

Roles: `super_admin`, `ops_lead`, `agentic_operator`.

## POST /chat

Body: `{"question": "...", "include_findings": true, "target_agent": "A6"}`

Response: `{"answer": "...", "model": "...", "kb_hits": N, "thread_id": 1}`

## POST /internal/tick

Header: `X-Ops-Internal-Token`. Worker cron 5 min.

```json
{
  "ok": true,
  "kb_indexed": 65,
  "runs": [{"ok": true, "scenario_id": "desk.api.health", "status": "ok", "findings_count": 0}],
  "total": 9
}
```
