Compile and schedule a cron job
const url = 'http://localhost:11044/api/v1/cron/compile';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"cron":"example","description":"example","inputTypeNames":["example"],"name":"example","outputTypeName":"example","toolNames":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”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
A job described in words, the body of POST /cron/compile: compiled into an action named cron-<name>, then scheduled
object
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
What the job should do, in natural language. Compiled into the action’s prompt, and kept as the job’s description
Domain types the compiled action takes as inputs; absent means none
Job name. The compiled action is saved as cron-<name>, and a job of the same name is replaced
Domain type the compiled action produces; absent or blank means a BackgroundMessage
Tools the compiled action may call; absent means none
Example generated
{ "cron": "example", "description": "example", "inputTypeNames": [ "example" ], "name": "example", "outputTypeName": "example", "toolNames": [ "example" ]}Responses
Section titled “Responses”Action compiled and job scheduled
object
Compilation or scheduling failed
A refusal from the cron or handler-adoption surface: the word error and the reason
object
Why the request was refused, written to be shown. Names the job or handler where the refusal is about one
Always error

