komrad

create_schedule

Create a schedule that, each time its cron expression matches, creates a task in workflow_id or mails the prompt to orchestrator_agent_id.

writesnot idempotentMCP toolSchedule

Calling it#

curl -X POST http://127.0.0.1:8787/komrad.schedule.v1.ScheduleService/CreateSchedule \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "<name>",
  "cron": "<cron>",
  "prompt": "<prompt>",
  "workflow_id": "<workflow_id>"
}'

Request#

CreateScheduleRequest#

FieldTypeDescription
namestring*

at most 200 characters

must not contain control characters

The schedule's name, which is also the title of each task the schedule creates.

cronstring*

must be five whitespace-separated fields, such as '0 9 * * 1-5'

The schedule's cron expression, in five fields separated by spaces.

timezonestring

at most 100 characters

The timezone to read the cron expression in. Empty uses the machine's timezone.

enabledbool

Whether the schedule starts enabled.

promptstring*

at most 50000 characters

The prompt each launched writer starts with, or the mail sent to the orchestrator.

one of*

What each run does.

workflow_iduuid

The workflow to create a task in, by id. The writer takes the workflow's directory and flags.

orchestrator_agent_iduuid

The orchestrator to mail the prompt to, by id.

Response#

CreateScheduleResponse#

FieldTypeDescription
scheduleSchedule

The schedule as created.

Types#

Schedule#

Schedule is a cron expression that creates a task or mails an orchestrator each time it matches.

FieldTypeDescription
iduuid*

The schedule's id.

namestring

The schedule's name.

cronstring

The schedule's cron expression, in five fields.

timezonestring

The timezone the cron expression is read in. Empty uses the machine's timezone.

enabledbool

Whether the schedule is enabled. A disabled schedule keeps its record and never runs.

promptstring

The prompt each launched writer starts with, or the mail sent to the orchestrator.

workflow_iduuid*

The id of the workflow the schedule belongs to. For an orchestrator schedule, the orchestrator's workflow.

kindScheduleKind

Whether the schedule creates a task or mails an orchestrator.

orchestrator_agent_iduuid

The id of the orchestrator the schedule mails. Set only on an orchestrator schedule.

next_run_attimestamp

When the cron expression next matches. Unset while the schedule is disabled.

latest_runScheduleRun

The schedule's newest run. Unset when the schedule has never run or the run's record has expired.

recent_runsScheduleRun[]

The schedule's newest runs, newest first. Set only in Watch events.

archived_attimestamp

When the schedule was archived. Unset while the schedule is live.

ScheduleRun#

ScheduleRun is one time a schedule's cron expression matched, with its state.

FieldTypeDescription
idint64

The run's id. A higher id is a newer run.

scheduled_fortimestamp

The time the cron expression matched for this run.

stateScheduleRunState

The run's state.

attemptint32

The run's current attempt, counting from one once the run has started.

max_attemptsint32

How many attempts the run has before it is discarded.

finalized_attimestamp

When the run finished. Unset while the run is waiting or running.

messagestring

Why the run was skipped, or the error from its last failed attempt. Empty when the run completed.

ScheduleKind#

ScheduleKind is what a schedule does each time its cron expression matches.

ValueDescription
orchestrator

Mails the prompt to a running orchestrator.

task

Creates a task in the workflow and launches its writer with the prompt.

ScheduleRunState#

ScheduleRunState is the state of one schedule run.

ValueDescription
available

Waiting to start.

pending

Held back until something releases the run.

scheduled

Waiting for a later time to start.

running

Running now.

retryable

Failed an attempt and waiting to try again.

completed

Launched the run's agent or sent the run's mail.

cancelled

Skipped, with the reason in the run's message.

discarded

Out of attempts, with the last error in the run's message.