Skip to content

feat(cronjob): add ScheduledRun for cron-based agent execution#1850

Draft
0xLeo258 wants to merge 1 commit into
kagent-dev:mainfrom
0xLeo258:feat/scheduled-run
Draft

feat(cronjob): add ScheduledRun for cron-based agent execution#1850
0xLeo258 wants to merge 1 commit into
kagent-dev:mainfrom
0xLeo258:feat/scheduled-run

Conversation

@0xLeo258
Copy link
Copy Markdown

@0xLeo258 0xLeo258 commented May 12, 2026

Introduces a new ScheduledRun CRD that allows users to schedule recurring agent invocations using cron expressions. The controller manages scheduling, concurrency policies, and run history tracking.

Key changes:

  • api: ScheduledRun types, spec (schedule, agentRef, prompt, suspend, concurrencyPolicy, maxRunHistory), status (lastRunTime, nextRunTime, active, runHistory)
  • controller: reconciler with cron scheduler (robfig/cron/v3)
  • httpserver: CRUD handlers for ScheduledRun resources
  • helm: RBAC rules for the new CRD
  • UI: full schedule management pages (list, create/edit, detail), run history table, server actions for CRUD + manual trigger
  • UI types: ScheduledRun, ConcurrencyPolicy, RunHistoryEntry interfaces

Closes #1821

@github-actions github-actions Bot added the enhancement New feature or request label May 12, 2026
@0xLeo258 0xLeo258 force-pushed the feat/scheduled-run branch 2 times, most recently from 7502b9e to bdcd3cb Compare May 12, 2026 06:00
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 13, 2026
@0xLeo258 0xLeo258 force-pushed the feat/scheduled-run branch 4 times, most recently from f414523 to 407a3ca Compare May 20, 2026 22:42
Adds ScheduledRun (kagent.dev/v1alpha2) to fire an existing agent on a cron
schedule with a static prompt. Scope is limited to scheduling — does not
extend the agent definition.

Two-stage status semantics: DispatchStatus is written synchronously (did
the A2A SendMessage land at the agent pod), Outcome is resolved
asynchronously by polling the session's terminal task state. This lets
RunHistory reflect whether the agent actually completed the work, not just
whether the dispatch HTTP call returned 200 — agents have built-in retries,
so dispatch success and run success are different signals.

Lands without controller-side concurrency gating: the agent pod already
serializes A2A calls per session, so overlapping ticks queue at the agent
layer rather than needing an inFlight map / mutex in the controller.

Includes CRD + controller, scheduler with outcome poller, REST API
(CRUD + manual trigger), Prometheus metrics, and UI (list, detail with
run history, create form). Manual trigger bypasses spec.suspend by design.

Co-authored-by: 0xLeo258 <0xLeo258@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
@0xLeo258 0xLeo258 force-pushed the feat/scheduled-run branch from 407a3ca to 1e3c6a4 Compare May 21, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add cronjob for agents

1 participant