Overview

The Automation API surfaces Gizzi Code’s cron/routine/loop runtime through the Allternit platform API. A goal is a platform-owned objective that can own routines (persistent scheduled jobs) and loops (session-scoped recurring jobs). Routines and loops can execute locally or in the cloud via the Gizzi cron daemon.

Base URL

For local development:

Authentication

All automation routes require a valid bearer token. See Authentication.

Data models

Goal

Routine

The local scheduler keeps these keys in metadata:

Loop

Endpoints

Goals

Routines

Loops

Local scheduler

Create a goal

Request body

Example request

Example response

Create a routine

Request body

Example request

Example response

Routines and bots

A local routine runs as a turn in its bot’s chat, so it must have a bot.
  • POST /routines without agent_id for a local routine returns 400 with {"error": "agent_required", "message": "..."}. An agent_id that names no agent returns 400 agent_not_found.
  • Local routines that have no bot (created before this rule) are never run. The scheduler sets metadata.needsAgent = true and clears next_run_at; the Bots UI lists them under Needs a bot.

Assign a routine to a bot

Sets the routine’s bot, removes needsAgent, consecutiveFailures and autoPaused, and resets next_run_at so the scheduler arms the next run from the schedule. Other fields are unchanged. An empty agent_id means no change; a routine cannot be unassigned.

Pause, resume and automatic pause

PUT with {"status": "paused"} pauses a routine; {"status": "active"} resumes it and clears consecutiveFailures and autoPaused, so it gets 3 more tries. After 3 failed runs in a row the scheduler sets status to paused, records metadata.autoPaused, and appends a routine.paused event to the bot’s activity ledger (next to the routine.failed event for each failed run).

Trigger a routine

Local routines run at once on this API and answer {"status": "running", "routineId": "...", "domain": "local"}; the result lands in the run history and the bot’s chat. A local routine with no bot returns 409 agent_required; one that is already running returns 409 already_running. Cloud routines run through the Gizzi cron daemon.

List routine runs

Returns stored runs for the routine, newest first, and for cloud routines attempts to sync the latest history from the Gizzi cron daemon. Local runs carry the thread they wrote to in metadata.sessionId.

Example response

Create a loop

Same request shape as a routine, plus an optional session_id and expires_at.

List local schedules

Returns all routines and loops whose execution_domain is local.

Example response

Error codes