Routines & Scheduling
Automate recurring tasks with cron triggers.
What are Routines?
Routines are predefined tasks that run automatically on a schedule. Ideal for:
- Daily: Morning reports, status updates, backups
- Weekly: Sprint reviews, cost summaries
- Hourly: Monitoring checks, API queries
- Event-based: Webhook triggers from external systems
Create a Routine
POST /api/unternehmen/:id/routinen
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "Daily Morning Report",
"beschreibung": "Generate a status report covering all ongoing projects.",
"expertId": "<agent-id>",
"concurrencyPolicy": "skip",
"catchUpPolicy": "skip"
}Fields
| Field | Values | Description |
|---|---|---|
concurrencyPolicy | skip, queue, replace | What happens if the routine is already running? |
catchUpPolicy | skip, run_once | What happens with missed executions? |
Execution History
GET /api/routinen/:id/ausfuehrungen
Authorization: Bearer <token>Response:
[
{
"id": "run-123",
"status": "success",
"gestartetAm": "2026-04-04T09:00:00Z",
"beendetAm": "2026-04-04T09:03:42Z",
"durationMs": 222000,
"triggerTyp": "schedule",
"tokenVerbrauch": 1240,
"kostenCent": 18
}
]Cron Triggers
Routines are triggered via 5-field cron expressions:
┌───────────── Minute (0–59)
│ ┌───────────── Hour (0–23)
│ │ ┌───────────── Day of month (1–31)
│ │ │ ┌───────────── Month (1–12)
│ │ │ │ ┌───────────── Day of week (0–6, Sun=0)
│ │ │ │ │
* * * * *Examples
| Expression | Description |
|---|---|
0 9 * * 1-5 | Weekdays at 9:00 AM |
0 * * * * | Every hour |
0 8 * * 1 | Every Monday at 8:00 AM |
*/15 * * * * | Every 15 minutes |
0 18 * * 5 | Fridays at 6:00 PM |
0 0 1 * * | First day of every month at midnight |
Trigger Types
Time-based execution with 5-field cron expression.
POST /api/routinen/:id/triggers
{
"typ": "schedule",
"cron": "0 9 * * 1-5"
}Immediate execution via API or dashboard.
POST /api/routinen/:id/trigger
Authorization: Bearer <token>Triggered by external systems via HTTP POST.
{
"typ": "webhook",
"secret": "my-webhook-secret"
}Concurrency & Catch-Up Policies
Concurrency Policy
Defines what happens when a trigger fires while the routine is still running:
| Policy | Behavior |
|---|---|
skip | New execution is skipped (recommended for long tasks) |
queue | New execution is queued |
replace | Running execution is cancelled, new one starts |
Catch-Up Policy
Defines what happens with missed executions (e.g. system was offline):
| Policy | Behavior |
|---|---|
skip | Missed executions are ignored |
run_once | One catch-up execution starts immediately |
For most use cases, we recommend concurrencyPolicy: "skip" and catchUpPolicy: "skip" to avoid queuing up executions when the system was briefly offline.
Routines API
| Method | Endpoint | Description |
|---|---|---|
GET | /api/unternehmen/:id/routinen | List all routines |
POST | /api/unternehmen/:id/routinen | Create routine |
GET | /api/routinen/:id | Routine details |
PATCH | /api/routinen/:id | Update routine |
DELETE | /api/routinen/:id | Delete routine |
GET | /api/routinen/:id/triggers | Get triggers |
POST | /api/routinen/:id/triggers | Create trigger |
POST | /api/routinen/:id/trigger | Trigger manually |
GET | /api/routinen/:id/ausfuehrungen | Execution history |