Security advisory — Malicious litellm versions 1.82.7 and 1.82.8 were removed from PyPI (potential API key exfiltration). Uninstall them, rotate exposed credentials, and upgrade to a safe release (e.g. 1.82.9+). Run pip show litellm to verify. PyPI · README

Long-Horizon Coding

Keep a coding task alive across polls and retries with isolated workspaces and a disk state machine.

Long-Horizon Coding

Use this when a coding job is longer than one chat turn: it must survive polls, stalls, and retries without stuffing the full history into one prompt.

Do not turn this on for a short SDK AgentExecutor.run. That path does not need longrun or project_state.

Diagram: each job keeps its own directory and a disk project_state.

Orchestrator

agenticx/longrun/ polls task sources, gives each task an isolated workspace, heals stalls, and applies continuation / failure backoff. Token use is counted incrementally (TaskTokenAccountant), not guessed from a single completion.

Shipped sources include a manual queue, cron, and project-feature source. Treat a source as real only if it is wired in longrun/sources/.

Disk state machine

project_state keeps a versioned feature state on disk (init → implement → verify → commit). File locks and atomic writes make the loop auditable after a crash.

Isolated workspace

TaskWorkspace pins the task to its own directory and rejects path escapes (TaskWorkspaceSecurityError). Hooks can fail closed (TaskWorkspaceHookError).

Worked example: keep a feature on disk

Scene. “Add login, with tests” will take many polls. You do not want the next retry to smash the previous workspace.

  1. Start the job through a wired longrun source (manual queue / cron / project feature in longrun/sources/).
  2. The orchestrator assigns an isolated TaskWorkspace. Path escapes raise TaskWorkspaceSecurityError.
  3. Watch project_state move init → implement → verify → commit. A stall detector retries with backoff instead of stuffing the whole history into one prompt.
  4. Token use is incremental (TaskTokenAccountant).

What you should see. A progress card that names the phase, not a static hourglass. After a crash, the same feature directory and state file are still there to audit.

Diagram: one task directory, and project_state moving init → implement → verify → commit.

Related

  • Agent Runtime — single-turn run_turn vs this multi-poll loop
  • Studio Server — HTTP routes under longrun/studio_routes.py
  • Deployment — where long jobs should not share a laptop lid-sleep session