Python job runtime

Write Python.
Otter runs it.

Schedule ordinary Python scripts with built-in retries, persistent state and execution history. No workflow framework. No infrastructure to manage.

sync_orders.py Python
import requests

def main(ctx):
    since = ctx.state.get("last_sync")

    orders = fetch_orders(since)
    save_orders(orders)

    ctx.state.set("last_sync", now())
Every 15 minutes Completed Conceptual example — adapt to the published Otter context API.

The problem

Your script works. Now keep it running.

You wrote the Python. It fetches data, calls APIs, and does exactly what you need.

Then comes the infrastructure.

Cron schedules it. A database remembers where it left off. Something else handles retries, logs and failures. Before long, a simple script has become a small distributed system.

Otter takes care of the running part.

what you end up maintaining
# crontab — the schedule
*/15 * * * * /opt/scripts/sync_orders.sh >> /var/log/sync.log 2>&1

# sync_orders.sh — a wrapper you did not want
cd /opt/app && git pull && python sync_orders.py

# a cursor file the script has to manage itself
/var/lib/sync-cursor.json

# retries: run it again by hand, if anyone noticed

# "did it run last night?"
grep "03:30" /var/log/sync.log

Four moving parts, no transaction between them, and a deploy that happens whenever someone types git pull.

Every job remembers where it left off.

Most scheduled jobs need to remember something.

The last order synced. The last page processed. The timestamp of a successful import.

Otter gives every job persistent key-value state, stored across runs. No separate database. No extra service. No state management framework.

Just your Python and the data it needs to remember.

the same key, two runs later
# run 1 — nothing remembered yet
since = ctx.state.get("last_sync")   # None
...
ctx.state.set("last_sync", now())

# run 2, fifteen minutes later — same job, same key
since = ctx.state.get("last_sync")   # 2026-10-08T03:30:00Z
On the contextWhat it does
ctx.state.get(k) Read a value, or None when it was never set.
ctx.state.set(k, v) Persist any JSON value for the next run.
ctx.state.delete(k) Forget a key when it no longer applies.

What you get

Six things you do not have to build.

Runs on schedule

Every minute, every hour, or whenever you need. Otter keeps track of when your code should run.

State that sticks

Keep cursors, timestamps and checkpoints between runs. No database setup required.

Failures handled

Automatic retries, timeouts and recovery when a run fails or the runtime restarts.

Know what happened

Inspect run history, logs, errors and retries. No more guessing whether cron ran.

Just Python

Use your existing Python code, libraries and dependencies. No new DSL or workflow framework.

One small runtime

A single Go binary backed by SQLite. No Redis, message broker or database server.

How it works

A job is a file and a manifest.

Otter discovers jobs in a directory you point it at. A run executes a released snapshot of that job — never your working tree — so an edit is not live until you release it.

  1. Describe the job

    An entrypoint plus a manifest: the schedule, timeout, retry policy, concurrency and secrets. Declared, not scripted.

  2. Release it

    Stage and activate an immutable snapshot with a digest. Roll back by activating the previous one.

  3. Let it run

    On a schedule, from a webhook, or by hand. Otter queues it, applies the policy and records what happened.

otter.yaml
version: 1

name: sync-orders
entrypoint: sync_orders.py

trigger:
  cron: "*/15 * * * *"

timeout: 300
concurrency: 1

retry:
  attempts: 5
  backoff: exponential
  initial_delay: 2s
  max_delay: 60s

secrets:
  - ORDERS_API_TOKEN

Your Python is unchanged. A job uses the Python interpreter on the host, or a managed one with locked dependencies. The SDK is standard library only and ships inside the binary, so import otter needs no install step.

When things go wrong

Built for work you can't watch.

Accepted work is never lost. If the daemon dies mid-run, the run is marked failed on the way back up and re-enqueued when policy allows. Queued work stays queued.

Retries that know the difference

Linear or exponential backoff with a cap. Configuration failures are never retried, because the next attempt would fail identically.

Timeouts

A run that overruns is terminated and marked timed out, then the retry policy applies.

Crash recovery

Anything left running is accounted for at startup and re-enqueued when policy allows. Recovery is fail-closed, not best-effort.

otter trace <run-id>
job: sync-orders   status: failed   attempt: 1 of 5
release: 8c1d4f0a9b3e   trigger: cron   duration: 41ms

TIME      KIND       DETAIL
03:30:00  ·  lifecycle  queued (trigger cron)
03:30:00  ✓  http       POST /v1/orders -> 200, 6ms
03:30:00  !  http       POST /v1/orders/commit -> 503, 9ms
03:30:00  ×  log        UpstreamError: batch rejected
03:30:00  ×  lifecycle  failed, exit code 1

# attempt 2 backs off, then resumes from the checkpoint
$ otter run-status 3f2a91c4
 ATTEMPT  STATUS      STARTED   DURATION
 1        failed      03:30:00  41ms
 2        succeeded   03:30:12  38ms

Outgoing HTTP is recorded during the run, so an unattended failure is reconstructable afterwards — headers and secrets redacted.

Scope

What Otter deliberately does not do.

These are published as non-promises in the runtime contract, so you can check them before you install rather than after.

  • It does not resume Python execution at the point of failure. You read your saved state and decide where to continue.
  • It does not replay cron occurrences missed while the daemon was offline.
  • It does not schedule across a fleet or shard work between hosts.
  • It does not inspect or transform your data — it runs your process.

Stop babysitting the schedule.

Install Otter, release the script you already have, and let the runtime remember what happened.

Alpha software · v0.5.3 · interfaces frozen since v0.4.0