Tasks (The Heartbeat)

Schedule and manage autonomous background agent tasks.

POST /v1/tasks

Schedule a new background task. The task runs The Soul on the specified cron schedule with full tenant-wide memory access.

Request

curl -X POST https://api.brainstormrouter.com/v1/tasks \
  -H "Authorization: Bearer br_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "daily-summary",
    "prompt": "Summarize key findings from today and store takeaways in archival memory.",
    "schedule": "0 18 * * *",
    "timezone": "America/New_York",
    "model": "anthropic/claude-sonnet-4-5"
  }'

Body parameters

ParameterTypeRequiredDescription
namestringYesHuman-readable task name
promptstringYesThe prompt The Soul executes each run
schedulestringYesCron expression (5-6 fields)
modelstringNoprovider/model format (default: system default)
timezonestringNoIANA timezone for the cron expression
conversation_idstringNoPin executions to a single session
descriptionstringNoOptional task description

Cron expression format

Standard 5-field cron (minute hour day month weekday):

ExpressionMeaning
0 Every hour
/15 *Every 15 minutes
0 9 1-5Weekdays at 9 AM
0 18 *Daily at 6 PM
0 0 1 First of every month

Response

{
  "task": {
    "id": "cron_abc123",
    "name": "daily-summary",
    "enabled": true,
    "schedule": {
      "type": "cron",
      "expression": "0 18 * * *",
      "timezone": "America/New_York"
    },
    "prompt": "Summarize key findings from today...",
    "model": "anthropic/claude-sonnet-4-5",
    "created_at": "2026-02-25T12:00:00.000Z",
    "updated_at": "2026-02-25T12:00:00.000Z",
    "state": {
      "next_run_at": "2026-02-25T23:00:00.000Z",
      "last_run_at": null,
      "last_status": null,
      "consecutive_errors": 0
    }
  }
}

---

GET /v1/tasks

List all tasks for the authenticated tenant.

Request

curl https://api.brainstormrouter.com/v1/tasks \
  -H "Authorization: Bearer br_live_..."

Response

{
  "tasks": [
    {
      "id": "cron_abc123",
      "name": "daily-summary",
      "enabled": true,
      "schedule": { "type": "cron", "expression": "0 18 * * *" },
      "state": {
        "next_run_at": "2026-02-25T23:00:00.000Z",
        "last_run_at": "2026-02-24T23:00:00.000Z",
        "last_status": "ok",
        "consecutive_errors": 0
      }
    }
  ],
  "total": 1
}

---

DELETE /v1/tasks/:id

Cancel and remove a task.

Request

curl -X DELETE https://api.brainstormrouter.com/v1/tasks/cron_abc123 \
  -H "Authorization: Bearer br_live_..."

Response

{
  "ok": true,
  "id": "cron_abc123"
}

Error responses

StatusDescription
400Invalid request (missing fields, bad cron expression)
403Insufficient permissions (requires config.write for POST/DELETE, config.read for GET)
404Task not found
500Server error