You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`--deliver`| bool | false | Deliver the agent's final response to the configured Telegram `default_chat_id`. Requires `telegram.bot_token` + `telegram.default_chat_id` in config. Use with cron for scheduled agent tasks. |
|`default_chat_id`| — | 0 |**Required for `--deliver`** — numeric chat ID where `odek run --deliver` sends results. Get this from your bot's update or use a tool like `@userinfobot`. |
308
+
309
+
### --deliver flag
310
+
311
+
The `--deliver` flag on `odek run` sends the agent's final response to the configured
312
+
`default_chat_id` as a plain text message. This enables **cron-based scheduled agent
313
+
workflows** — no daemon needed.
314
+
315
+
```bash
316
+
# Run an agent task and deliver the result to Telegram
317
+
odek run --deliver "Check the CI pipeline status"
318
+
319
+
# Works with task text first too
320
+
odek run "Daily summary" --deliver
321
+
```
322
+
323
+
See [docs/TELEGRAM.md](docs/TELEGRAM.md#cron-integration) for full cron setup instructions.
Copy file name to clipboardExpand all lines: docs/TELEGRAM.md
+91Lines changed: 91 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -378,6 +378,97 @@ This avoids binary overwrite races, stale HTTP/2 connections, and session contex
378
378
379
379
A fire-and-forget goroutine sends `sendChatAction("typing")` every 4 seconds while the agent runs. Each API call is dispatched in its own goroutine so a slow or hanging HTTP call cannot block the ticker and permanently stop the indicator.
380
380
381
+
## Cron Integration
382
+
383
+
odek can run fully offline agent tasks and deliver the result to Telegram, enabling system cron-based scheduled agent workflows — no daemon or scheduler required.
384
+
385
+
### How it works
386
+
387
+
```
388
+
cron daemon ──[every N minutes]──► odek run "<task>" --deliver
389
+
│
390
+
┌──────┴──────┐
391
+
│ agent loop │
392
+
│ (no daemon) │
393
+
└──────┬──────┘
394
+
│ result text
395
+
▼
396
+
Telegram API
397
+
│
398
+
┌──────┴──────┐
399
+
│ your chat │
400
+
└─────────────┘
401
+
```
402
+
403
+
Each cron tick spawns an independent `odek run` process. The agent executes the task, produces a result, and exits. The `--deliver` flag sends the result to your configured Telegram chat as a plain text message. No persistent bot process, no long-polling — just a single agent run per tick.
404
+
405
+
### Prerequisites
406
+
407
+
1.**Telegram bot token** and **default chat ID** must be configured in `~/.odek/config.json`:
408
+
409
+
```json
410
+
{
411
+
"telegram": {
412
+
"bot_token": "8610437446:AAElHFJ...",
413
+
"default_chat_id": 8592463065
414
+
}
415
+
}
416
+
```
417
+
418
+
2.**Verify delivery works** before setting up cron:
419
+
420
+
```bash
421
+
odek run "Say hello" --deliver
422
+
```
423
+
424
+
If no message arrives, check:
425
+
- The bot token is valid (`curl https://api.telegram.org/bot<TOKEN>/getMe`)
426
+
- The `default_chat_id` is correct (the numeric chat ID, not the username)
427
+
- The binary is at a stable path (system cron uses a minimal PATH, so use the full path)
0 commit comments