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
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 /routineswithoutagent_idfor a local routine returns400with{"error": "agent_required", "message": "..."}. Anagent_idthat names no agent returns400agent_not_found.- Local routines that have no bot (created before this rule) are never run. The scheduler sets
metadata.needsAgent = trueand clearsnext_run_at; the Bots UI lists them under Needs a bot.
Assign a routine to a bot
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
{"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
status: "running" when it starts and completed in place when it ends. Its metadata holds:
status is one of running, succeeded, failed, skipped or cancelled (stopped; a cloud run the daemon reports as aborted is stored as cancelled). A run left running when the API stopped is marked failed with outcome_reason: "runtime_restart" at the next start.
Example response
Recent runs in the routine list
recentRuns, newest first, for a run-history strip without one request per routine. A local run in progress is listed first with status: "running" even before its row is read.
Watch a run in progress
{"running": true, "runId", "startedAt", "sessionId", "steps", "apps", "model", "text", "canStop": true}. steps is the turn’s todo list so far and text is the last 600 characters it has written. For a cloud run it answers running with empty steps and apps (the daemon does not report them). When nothing is running it answers {"running": false}. Poll it every few seconds while a run is going.
Stop a run
status: "cancelled", outcome_reason: "stopped" and the text it had written as output. A stopped run does not count toward the automatic pause and opens no “Something needs fixing” item. Answers {"status": "stopping", "runId"}. A run that already finished returns 409 not_running. For a cloud routine the API asks the Gizzi cron daemon to stop the job’s run (POST /jobs/:id/abort); a daemon too old to stop runs returns 502 stop_failed.
Create a loop
session_id and expires_at.
List local schedules
execution_domain is local.
Example response
Routines and loops tied to a thread
A routine or loop created from inside a bot thread belongs to that thread. On create, whenmetadata.sessionId (routine) or sessionId (loop) is one of a thread’s sessions, the server stamps metadata.sourceThreadId. When the thread is resolved, archived or paused by its owner, its tied routines and loops are set to paused with metadata.closedWithThread, and the matching Gizzi cron jobs stop. Reopening the thread sets them back to active. See Threads and subagents.
Error codes
Related pages
Cloud by default
When the account has a cloud computer (paid plans; free accounts don’t get one), the apps (Desktop, ai.allternit.com, m.allternit.com) create new routines on the cloud computer, so they run with your own computer closed:- The cloud computer is the first
wakeableruntime inGET /api/v1/runtime-presence, the same list the bot’s Stay on picker uses. - The routine is created on that computer’s own API. When the page talks to another computer, the request goes through the cloud relay (
POST /api/v1/runtime-devices/:id/proxy). The routine list shows both computers’ routines, and calls for a cloud routine (run, runs, live, stop, metrics, edit, delete) go to the cloud computer. - Changing Runs on for a routine moves it: it is created on the other computer and removed from the first. Its run history stays behind.
- Event-triggered routines and phone-skill replays stay on this computer, since they depend on it.
- The bot has to exist on the cloud computer, so the app copies it there first, every time (an upsert, so Soul and memory edits stay fresh):
GET /api/v1/agents/:id/packageon this computer, thenPUT /api/v1/agents/:id/packageon the cloud computer through the relay. See Copy a bot to another computer. If the copy fails, nothing is saved and the app saysCouldn't copy <bot name> to your cloud computer: <reason>. A create for a bot the computer doesn’t have still fails withagent_not_found. - The cloud computer needs its own brain sign-in: model sign-ins are not copied.
- A run on the cloud computer that finds a brain signed out fails with reason
lane_blocked, and the app shows “Something needs fixing” as for any failed run.