Skip to content

Compile and schedule a cron job

POST
/api/v1/cron/compile
curl --request POST \
--url http://localhost:11044/api/v1/cron/compile \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "cron": "example", "description": "example", "inputTypeNames": [ "example" ], "name": "example", "outputTypeName": "example", "toolNames": [ "example" ] }'

Describes what the job should do in natural language, compiles an action, and schedules it. This combines action compilation with cron scheduling in a single step.

The job to build and when to run it. description says in natural language what the job does: it is compiled into a world action named cron-<name> and kept as the job’s description. cron is the Spring 6-field expression it fires on, in the caller’s own time zone. toolNames, inputTypeNames and outputTypeName are optional and passed to the compiler; omitted means none. A job with the same name is replaced

Media typeapplication/json

A job described in words, the body of POST /cron/compile: compiled into an action named cron-<name>, then scheduled

object
cron
required

Spring 6-field cron expression (seconds minutes hours day-of-month month day-of-week), evaluated in the user’s time zone. Not validated here: an unparseable one is saved but never fires

string
description
required

What the job should do, in natural language. Compiled into the action’s prompt, and kept as the job’s description

string
inputTypeNames

Domain types the compiled action takes as inputs; absent means none

Array<string>
unique items
name
required

Job name. The compiled action is saved as cron-<name>, and a job of the same name is replaced

string
outputTypeName

Domain type the compiled action produces; absent or blank means a BackgroundMessage

string
toolNames

Tools the compiled action may call; absent means none

Array<string>

Example generated

{
"cron": "example",
"description": "example",
"inputTypeNames": [
"example"
],
"name": "example",
"outputTypeName": "example",
"toolNames": [
"example"
]
}

Action compiled and job scheduled

Media type*/*
object
key
additional properties
string

Compilation or scheduling failed

Media type*/*

A refusal from the cron or handler-adoption surface: the word error and the reason

object
message
required

Why the request was refused, written to be shown. Names the job or handler where the refusal is about one

string
status
required

Always error

string
Allowed values: error