$npx -y skills add MagicCube/agentara --skill scheduled-tasksManage Agentara scheduled tasks (cronjobs). Use when the user wants to create, list, update, or delete recurring scheduled tasks — triggered by phrases like "add a cronjob", "schedule a task", "remind me to do something after 10 minutes", "list my scheduled tasks", "remove cronjo
| 1 | ## Overview |
| 2 | |
| 3 | This skill manages Agentara scheduled tasks via the REST API at `http://localhost:1984/api/cronjobs`. |
| 4 | |
| 5 | A scheduled task has two parts: |
| 6 | |
| 7 | - **What**: an `instruction` (natural language prompt sent to the agent) |
| 8 | - **When**: a `schedule` object with one of `at`/`delay` (one-shot) or `pattern`/`every` (recurring), plus optional `limit` and `immediately` |
| 9 | |
| 10 | ### session_id: contextual vs independent |
| 11 | |
| 12 | - **Independent** (default): omit `session_id`. Each trigger creates a new session — the agent has no memory of previous runs. Suitable for most cronjobs. |
| 13 | - **Contextual**: pass a fixed `session_id` (generate one via `python3 -c "import uuid; print(uuid.uuid4())"`). All triggers share the same conversation session — the agent can reference previous runs. Use this only when continuity matters (e.g. daily standup that tracks progress over time). |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | ## Workflow |
| 18 | |
| 19 | ### Step 1: Understand intent |
| 20 | |
| 21 | Ask or infer what the user wants: |
| 22 | |
| 23 | | Intent | Action | |
| 24 | | --------------------------------------------- | --------------------------- | |
| 25 | | "list cronjobs" / "show scheduled tasks" | **List** | |
| 26 | | "add a cronjob" / "schedule a task every ..." | **Create** | |
| 27 | | "update cronjob" / "change schedule to ..." | **Update** (upsert by `id`) | |
| 28 | | "delete cronjob" / "remove scheduled task" | **Delete** | |
| 29 | |
| 30 | ### Step 2: Determine whether session_id is needed |
| 31 | |
| 32 | Ask yourself: does this task need to remember context across triggers? |
| 33 | |
| 34 | - "Summarize today's news" → **No**. Each run is self-contained. Omit `session_id`. |
| 35 | - "Check project progress and compare with yesterday" → **Yes**. The agent needs prior context. Generate a fixed `session_id`. |
| 36 | |
| 37 | If unsure, ask the user: "Should each trigger run independently, or do you need them to share conversation history?" |
| 38 | |
| 39 | ### Step 3: Execute |
| 40 | |
| 41 | Use `Bash` to run `curl` commands against the API. All examples below use `localhost:1984`. |
| 42 | |
| 43 | > **IMPORTANT**: Never pipe write operations (POST/PUT/DELETE) through `jq`. If `jq` fails to parse the response, the `curl` request has still been sent and executed server-side. Retrying the command will create duplicates or cause unintended side effects. Only use `| jq .` for read operations (GET). For write operations, output the raw response directly. |
| 44 | |
| 45 | --- |
| 46 | |
| 47 | ## API Reference |
| 48 | |
| 49 | ### List all scheduled tasks |
| 50 | |
| 51 | ```bash |
| 52 | curl -s http://localhost:1984/api/cronjobs | jq . |
| 53 | ``` |
| 54 | |
| 55 | > `jq` is safe here because GET is read-only. Never use `| jq .` on POST/PUT/DELETE commands. |
| 56 | |
| 57 | ### Create — independent (no session_id) |
| 58 | |
| 59 | Most common case. Each trigger starts a fresh session. |
| 60 | |
| 61 | **Cron pattern** (every day at 9 AM): |
| 62 | |
| 63 | ```bash |
| 64 | curl -s -X POST http://localhost:1984/api/cronjobs \ |
| 65 | -H "Content-Type: application/json" \ |
| 66 | -d '{ |
| 67 | "instruction": "Summarize today'\''s top tech news", |
| 68 | "schedule": { "pattern": "0 9 * * *" } |
| 69 | }' |
| 70 | ``` |
| 71 | |
| 72 | **Interval** (every 30 minutes): |
| 73 | |
| 74 | ```bash |
| 75 | curl -s -X POST http://localhost:1984/api/cronjobs \ |
| 76 | -H "Content-Type: application/json" \ |
| 77 | -d '{ |
| 78 | "instruction": "Check all services are healthy", |
| 79 | "schedule": { "every": 1800000 } |
| 80 | }' |
| 81 | ``` |
| 82 | |
| 83 | **Cron + limit** (every Friday 6 PM, max 10 times): |
| 84 | |
| 85 | ```bash |
| 86 | curl -s -X POST http://localhost:1984/api/cronjobs \ |
| 87 | -H "Content-Type: application/json" \ |
| 88 | -d '{ |
| 89 | "instruction": "Generate weekly project report", |
| 90 | "schedule": { "pattern": "0 18 * * 5", "limit": 10 } |
| 91 | }' |
| 92 | ``` |
| 93 | |
| 94 | **Interval + immediately** (every hour, first run right now): |
| 95 | |
| 96 | ```bash |
| 97 | curl -s -X POST http://localhost:1984/api/cronjobs \ |
| 98 | -H "Content-Type: application/json" \ |
| 99 | -d '{ |
| 100 | "instruction": "Sync upstream repository changes", |
| 101 | "schedule": { "every": 3600000, "immediately": true } |
| 102 | }' |
| 103 | ``` |
| 104 | |
| 105 | **Delay** (one-shot after 10 minutes): |
| 106 | |
| 107 | ```bash |
| 108 | curl -s -X POST http://localhost:1984/api/cronjobs \ |
| 109 | -H "Content-Type: application/json" \ |
| 110 | -d '{ |
| 111 | "instruction": "Remind me to review the report", |
| 112 | "schedule": { "delay": 600000 } |
| 113 | }' |
| 114 | ``` |
| 115 | |
| 116 | **All schedule options** (cron + interval + limit + immediately): |
| 117 | |
| 118 | ```bash |
| 119 | curl -s -X POST http://localhost:1984/api/cronjobs \ |
| 120 | -H "Content-Type: application/json" \ |
| 121 | -d '{ |
| 122 | "instruction": "Run full regression test suite", |
| 123 | "schedule": { |
| 124 | "pattern": "0 2 * * *", |
| 125 | "every": 86400000, |
| 126 | "limit": 30, |
| 127 | "immediately": true |
| 128 | } |
| 129 | }' |
| 130 | ``` |
| 131 | |
| 132 | ### Create — contextual (with session_id) |
| 133 | |
| 134 | First generate a UUID: |
| 135 | |
| 136 | ```bash |
| 137 | SESSION_ID=$(python3 -c "import uuid; print(uuid.uuid4())") |
| 138 | ``` |
| 139 | |
| 140 | Then pass it. All triggers will share this session's conversation history: |
| 141 | |
| 142 | ```bash |
| 143 | curl -s -X POST http://localhost:1984/api/cronjobs \ |
| 144 | -H "Con |