File size: 2,337 Bytes
1d3594f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Integrations

mona-agent is designed to be glued into whatever you already run.

## Cloud REST API (client view)

The daemon talks to the control plane at `https://agent.mona.expert` over
HTTPS with Bearer auth. From a client perspective the endpoints are:

| Method | Path | Purpose |
|---|---|---|
| GET | `/api/v1/agent/health` | Cloud health / uptime check |
| GET | `/api/v1/agent/verify` | Validate the device token |
| POST | `/api/v1/agent/chat/:agentId` | Send a chat message, get a reply |
| POST | `/api/v1/agent/tool/:agentId` | Execute a tool directly |
| GET | `/api/v1/agent/agents` | List your agents |
| POST | `/api/v1/agent/think` | Streaming reasoning (SSE) |
| POST | `/api/v1/agent/stats` | Device metrics snapshot (every 10 s) |

The client picks the right base URL and paths automatically
(`MONA_CLOUD` overrides the default).

## Boot persistence

Keep the daemon alive across reboots:

- **macOS** — install [examples/macos/com.monaexpert.agent.plist](../examples/macos/com.monaexpert.agent.plist)
  into `~/Library/LaunchAgents/` and `launchctl load` it.
- **Linux (systemd)** — drop [examples/linux/mona-agent.service](../examples/linux/mona-agent.service)
  into `~/.config/systemd/user/` and `systemctl --user enable --now mona-agent`.
- **cron fallback** — `@reboot $HOME/.local/bin/mona-agent start`

## Scheduling

The agent plays nicely with cron (see [EXAMPLES.md](EXAMPLES.md) for
recipes). One-liners:

```bash
mona-agent chat "…"   # ask the cloud brain, answer in dashboard history
mona-agent exec "…"   # run a guarded command, stream the output
```

## Health checks

- **Interactive** — `mona-agent connect` runs the full connectivity test
  (health, auth, agent list) and prints the result.
- **Scripted** — parse `mona-agent connect` exit code in your monitoring:

```bash
if mona-agent connect; then echo "agent ok"; else echo "agent degraded"; fi
```

## Webhooks & outbound calls

The `net` tool lets the agent call your webhooks, health endpoints or
notification services (outbound HTTPS only):

```bash
mona-agent exec "curl -fsS https://hc-ping.com/<your-uuid>"
```

## Building on the client

- `packages/engine` — the cloud-brain client (self-contained)
- `packages/protocol` — typed message schemas shared with the cloud

Both are MIT licensed; reuse them freely.