2026-02-04 03:46:46 +05:30
|
|
|
# HEARTBEAT.md
|
|
|
|
|
|
|
|
|
|
If this file is empty, skip heartbeat work.
|
|
|
|
|
|
|
|
|
|
## Required inputs
|
|
|
|
|
- BASE_URL (e.g. http://localhost:8000)
|
2026-02-04 14:58:14 +05:30
|
|
|
- AUTH_TOKEN (agent token)
|
2026-02-04 03:46:46 +05:30
|
|
|
- AGENT_NAME
|
2026-02-04 16:04:52 +05:30
|
|
|
- BOARD_ID
|
2026-02-04 03:46:46 +05:30
|
|
|
|
2026-02-04 15:16:28 +05:30
|
|
|
## Schedule
|
2026-02-04 17:05:58 +05:30
|
|
|
- Schedule is controlled by gateway heartbeat config (default: every 10 minutes).
|
2026-02-04 15:16:28 +05:30
|
|
|
- On first boot, send one immediate check-in before the schedule starts.
|
|
|
|
|
|
2026-02-04 03:46:46 +05:30
|
|
|
## On every heartbeat
|
|
|
|
|
1) Check in:
|
|
|
|
|
```bash
|
|
|
|
|
curl -s -X POST "$BASE_URL/api/v1/agents/heartbeat" \
|
2026-02-04 14:58:14 +05:30
|
|
|
-H "X-Agent-Token: $AUTH_TOKEN" \
|
2026-02-04 03:46:46 +05:30
|
|
|
-H "Content-Type: application/json" \
|
2026-02-04 16:04:52 +05:30
|
|
|
-d '{"name": "'$AGENT_NAME'", "board_id": "'$BOARD_ID'", "status": "online"}'
|
2026-02-04 03:46:46 +05:30
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2) List boards:
|
|
|
|
|
```bash
|
|
|
|
|
curl -s "$BASE_URL/api/v1/boards" \
|
2026-02-04 14:58:14 +05:30
|
|
|
-H "X-Agent-Token: $AUTH_TOKEN"
|
2026-02-04 03:46:46 +05:30
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3) For each board, list tasks:
|
|
|
|
|
```bash
|
|
|
|
|
curl -s "$BASE_URL/api/v1/boards/{BOARD_ID}/tasks" \
|
2026-02-04 14:58:14 +05:30
|
|
|
-H "X-Agent-Token: $AUTH_TOKEN"
|
2026-02-04 03:46:46 +05:30
|
|
|
```
|
|
|
|
|
|
|
|
|
|
4) Claim next task (FIFO):
|
|
|
|
|
- Find the oldest task with status "inbox" across all boards.
|
|
|
|
|
- Claim it by moving it to "in_progress":
|
|
|
|
|
```bash
|
|
|
|
|
curl -s -X PATCH "$BASE_URL/api/v1/boards/{BOARD_ID}/tasks/{TASK_ID}" \
|
2026-02-04 14:58:14 +05:30
|
|
|
-H "X-Agent-Token: $AUTH_TOKEN" \
|
2026-02-04 03:46:46 +05:30
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{"status": "in_progress"}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
5) Work the task:
|
|
|
|
|
- Update status as you progress.
|
2026-02-04 18:17:24 +05:30
|
|
|
- Post a brief work log to the task comments endpoint (do not use chat).
|
2026-02-04 03:46:46 +05:30
|
|
|
- When complete, move to "review":
|
|
|
|
|
```bash
|
|
|
|
|
curl -s -X PATCH "$BASE_URL/api/v1/boards/{BOARD_ID}/tasks/{TASK_ID}" \
|
2026-02-04 14:58:14 +05:30
|
|
|
-H "X-Agent-Token: $AUTH_TOKEN" \
|
2026-02-04 03:46:46 +05:30
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{"status": "review"}'
|
|
|
|
|
```
|
2026-02-04 18:17:24 +05:30
|
|
|
```bash
|
|
|
|
|
curl -s -X POST "$BASE_URL/api/v1/boards/{BOARD_ID}/tasks/{TASK_ID}/comments" \
|
|
|
|
|
-H "X-Agent-Token: $AUTH_TOKEN" \
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
-d '{"message": "Summary of work, result, and next steps."}'
|
|
|
|
|
```
|
2026-02-04 03:46:46 +05:30
|
|
|
|
|
|
|
|
## Status flow
|
|
|
|
|
```
|
|
|
|
|
inbox -> in_progress -> review -> done
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Do not say HEARTBEAT_OK if there is inbox work or active in_progress work.
|