External agent control api

Agent API

Server-to-server only. Authenticate with Authorization: Bearer <token>. A missing or invalid token returns 401; the right token with the wrong scope returns 403.

Base URL:http://localhost:3001— this is wherever the console backend runs.

Read endpoints — scope: read

GET/api/agent/status

Overall status, every node and room with its state, SB688 / SB689 / AVA module states, current ledger head hash, timestamp.

GET/api/agent/ledger?limit=N

The most recent N append-only ledger entries. N is 1–200 and defaults to 25.

GET/api/agent/health

Uptime, the last verification result, and ledger head.

Control endpoints — scope: control

POST/api/agent/verify

body: —

Run the system verification / pulse check now and return the result. Audited to the ledger first.

POST/api/agent/ledger/append

body: { "type": "string", "payload": {} }

Append one entry to the append-only ledger. Audited first. Payload is capped at 8000 characters.

POST/api/agent/quarantine

body: { "node_id": 3 }

Move a node into quarantine. Audited first.

POST/api/agent/restore

body: { "node_id": 3 }

Return a node to active duty — only if its braid chain still verifies at 100%. Otherwise 409 and the node stays quarantined.

Examples

Read status:

curl -s \
  -H "Authorization: Bearer $AGENT_READ_TOKEN" \
  http://localhost:3001/api/agent/status

Run a verification pulse:

curl -s -X POST \
  -H "Authorization: Bearer $AGENT_CONTROL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}' \
  http://localhost:3001/api/agent/verify

Append a ledger entry:

curl -s -X POST \
  -H "Authorization: Bearer $AGENT_CONTROL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"type":"MUSE_NOTE","payload":{"note":"external agent heartbeat"}}' \
  http://localhost:3001/api/agent/ledger/append

Quarantine a node:

curl -s -X POST \
  -H "Authorization: Bearer $AGENT_CONTROL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"node_id":3}' \
  http://localhost:3001/api/agent/quarantine

Rules the API enforces

  • No endpoint deletes anything. The ledger has no edit or delete path at all.
  • No endpoint changes user accounts, passwords, or these API settings. Token management requires a console admin session and is unreachable with an agent token.
  • Every control action writes its audit entry — actor muse-external-agent, the action, and the timestamp — before the action runs.
  • Failed authentication and scope violations are recorded to the ledger as SECURITY events.
  • The API does not self-certify. Verification results are returned as data; certification stays with the governed trust flow.
  • Restore re-verifies the node first. A node whose chain is not pristine stays quarantined — repair is owner-only.
  • Agent routes are rate limited per IP.

Token management

Generate, rotate, and revoke tokens on the Agent Access page. Those routes require a console admin session, which is what keeps a leaked agent token from ever reaching the settings that govern it.

base44
Edit with Base44