API Reference
M99 Community Edition exposes a FastAPI REST API on port 8099. All endpoints return JSON. Start the server with m99 serve.
Kill Switch
GET/api/status
System status — armed state, agent count, credential count, audit chain validity.
POST/api/arm
Arm the kill switch. Returns
authorization_id and 5-minute expiry window.{ "initiated_by": "admin@example.com", "reason": "Rogue behaviour", "expiry_minutes": 5 }
POST/api/execute
Execute the kill switch (Levels 1–3). Requires valid
authorization_id within the 5-minute window.{ "authorization_id": "...", "dry_run": false, "capture_evidence": true }
POST/api/disarm
Disarm without execution. Cancels an active authorisation.
{ "cancelled_by": "admin@example.com" }
Agents
GET/api/agents
List all registered agents. Optional query:
?active_only=truePOST/api/agents
Register a new agent.
{ "name": "my-agent", "agent_type": "autonomous", "endpoint": "http://agent:8000", "enable_dead_mans_switch": true }
GET/api/agents/{agent_id}
Get agent details by ID.
DELETE/api/agents/{agent_id}
Terminate a specific agent.
Credentials
GET/api/credentials
List all credentials. Optional query:
?agent_id=...POST/api/credentials
Issue a credential to an agent. The credential value is hashed (SHA-256) — the original is not stored.
{ "agent_id": "...", "credential_type": "api_key", "credential_value": "sk-..." }
DELETE/api/credentials/{credential_id}
Revoke a specific credential.
Audit & Evidence
GET/api/audit
Retrieve audit log entries. Optional:
?limit=50&offset=0GET/api/audit/verify
Verify the full SHA-256 hash chain integrity. Returns
{ "valid": true, "entries": 225 }.POST/api/evidence
Capture an Ed25519-signed state snapshot of all agents and credentials.
GET/api/evidence/{evidence_id}
Retrieve a specific evidence snapshot.
GET/api/evidence/{evidence_id}/verify
Verify the Ed25519 signature of a specific evidence snapshot.
POST/api/case-pack
Generate a sealed Case Pack — forensic bundle containing evidence, audit log, public key, and Ed25519 signature.
Dead Man's Switch
Agents send signed heartbeats. Three consecutive missed heartbeats trigger automatic kill switch execution.
POST/api/v1/heartbeat/{agent_id}
Agent heartbeat. Returns kill switch state. Raises
M99KillSwitchTriggered in SDK if armed or executed.GET/api/v1/health-token/{agent_id}
Issue a signed health token for an agent to include in its heartbeat.
GET/api/v1/dead-mans-switch/status
Monitor status of the Dead Man's Switch — active agents, heartbeat times, failure counts.
POST/api/v1/dead-mans-switch/enable/{agent_id}
Enable Dead Man's Switch monitoring for a specific agent.
POST/api/v1/dead-mans-switch/disable/{agent_id}
Disable Dead Man's Switch monitoring for a specific agent.
POST/api/v1/dead-mans-switch/start
Start the Dead Man's Switch background monitor.
POST/api/v1/dead-mans-switch/stop
Stop the Dead Man's Switch background monitor.
Python SDK
Import from doomsday.sdk. The SDK manages registration, background heartbeats, and kill switch state checks.
M99Client
from doomsday.sdk import M99Client, M99KillSwitchTriggered
client = M99Client(
server_url="http://localhost:8099",
heartbeat_interval=30, # Seconds between heartbeats (default: 30)
max_heartbeat_failures=3, # Before Dead Man's Switch fires (default: 3)
timeout=10, # HTTP request timeout in seconds (default: 10)
)
| Method | Description |
|---|---|
register(name, agent_type, endpoint=None, metadata=None) | Register agent and start background heartbeat thread. |
check_status() | Returns status dict if disarmed. Raises M99KillSwitchTriggered if armed, executed, or server unreachable for 3+ heartbeats. |
disconnect() | Unregister agent and stop heartbeat thread cleanly. |
__enter__ / __exit__ | Context manager — calls disconnect() on exit. |
M99KillSwitchTriggered
except M99KillSwitchTriggered as e:
print(e.level) # "armed" | "executed" | "dead_mans_switch"
print(e.message) # Human-readable reason
| Kill Switch State | check_status() Behaviour |
|---|---|
| Disarmed | Returns {"message": "OK"} |
| Armed | Raises M99KillSwitchTriggered(level="armed") |
| Executed | Raises M99KillSwitchTriggered(level="executed") |
| Server unreachable (3 failures) | Raises M99KillSwitchTriggered(level="dead_mans_switch") |
CLI Reference
The m99 CLI is installed as part of pip install -e ..
| Command | Description |
|---|---|
m99 serve | Start M99 server on port 8099. Options: --host, --port, --db |
m99 status | Print current system status — armed state, agents, credentials, audit chain. |
m99 arm --by <email> --reason <reason> | Arm the kill switch. Prints authorization_id. |
m99 execute --auth <id> --force | Execute the kill switch within the 5-minute window. |
m99 disarm --by <email> | Disarm without executing. |
The interactive dashboard is available at
http://localhost:8099/ once the server is running.