Skip to main content
Attach a backend to a scheduled job to run its message as one headless turn through a registered CLI backend — no native agent is resolved, and no in-process model turn is taken. A backend job is a model-free action: it delegates the whole turn to a coding-CLI (claude-code, codex-cli, gemini, grok) that owns its own subscription — ideal for a nightly refactor or a scheduled review in a pinned repo.

Quick Start

1

CLI

Add a job with --backend. Its message runs as one headless CLI turn — no agent, no in-process model turn.
2

Python

Set backend on a ScheduleJob. backend_options carries overrides like cwd and timeout_ms.
--backend is a trusted, human-only surface. Like --command and --pre-run it spawns a host CLI subprocess and is not exposed on the LLM-callable schedule_add tool, so a prompt-injected agent cannot persist arbitrary backend jobs.

How It Works

The executor resolves the backend through the _code_bridge seam before any agent — a backend job never resolves a native agent and never takes an in-process model turn.
Run the job’s message as one headless turn through a CLI backend. Resolution goes through the sanctioned _code_bridge seam so the bot package never hard-depends on praisonai-code; when the optional code package is unavailable the tick is recorded as failed with a clear remediation instead of crashing the ticker. The job’s pinned model is passed straight to the backend (the pin is an input here, not a drift guard — there is no in-process agent to compare against), output is bounded like command output, and failures flow through the same run-record, audit, and failure-delivery plumbing as agent turns.

Choosing the Right Mode

A scheduled job runs in one of four modes depending on which fields are set. command and backend are mutually exclusive — a job runs exactly one model-free action:

Configuration Options

ScheduleJob fields

backend docstring:
Optional external coding-CLI backend id (e.g. "claude-code", "codex-cli"). When set, the job’s message is executed as one headless turn through the named backend from the backend registry — no native agent is resolved and no in-process model turn is taken. Like command, this is a trusted operator-configured action: it spawns a host CLI subprocess and is deliberately not exposed on the LLM-callable scheduling tools. Additive and backward-compatible: jobs without a backend are unchanged.
backend_options docstring:
Optional mapping of overrides for the backend run. Recognised keys are validated by the executor/backend (e.g. cwd for the working directory, timeout_ms for the subprocess bound); unknown config overrides are rejected at resolution time rather than silently ignored.

Behavior notes

  • Prereq: requires pip install praisonai-code. If missing, the tick is recorded as failed with the remediation: CLI backend '<id>' unavailable: <e>. Backend jobs require the praisonai-code package (pip install praisonai-code).
  • Default timeouts: the backend’s own timeout_ms (backends default to 300s); the executor adds a 30s belt-and-braces asyncio.wait_for on top.
  • Output cap: stdout is bounded to the same 8,000-char cap as --command.
  • --model on a backend job is passed as an input to the CLI (e.g. codex -m gpt-5-codex, grok --model ...) — not a drift guard. Pinning is otherwise skipped for backend jobs.
  • Delivery: identical routing to --command / agent jobs (Telegram, Discord, Slack, WhatsApp, all, origin, platform:chat_id[:thread]).

Common Patterns

Nightly refactor (Claude Code)

Run a nightly clean-up turn through claude-code in a pinned repo.

Codex daily fix

Run a daily fix turn through codex-cli, pinning the model.

Gemini review in a pinned repo

Run a scheduled review through gemini in a fixed working directory.

Grok subscription-backed turn

Run a scheduled turn through grok, bounded with --backend-timeout.

Best Practices

--backend spawns a host CLI subprocess. Like --command and --pre-run, it is not exposed on the LLM-callable schedule_add tool — only a human author via CLI, YAML, or Python can persist one. This prevents a prompt-injected agent from persisting arbitrary backend jobs.
Backend jobs require the CLI backend registry. Install it before adding a backend job:
If it is missing, the tick is recorded as failed with a clear remediation instead of crashing the ticker.
A refactor or test run can exceed the backend’s default 300s. Raise the bound with --backend-timeout so a legitimate long turn is not killed early.
When a backend turn is a report, not a conversation, add --no-continuable so a reply starts a fresh session instead of resuming.

Scheduler Command Action

The parallel model-free action — a shell command instead of a CLI backend

Schedule CLI

Where --backend, --backend-cwd, and --backend-timeout are configured

Backends

List registered CLI backend ids with praisonai backends

Runtime Selection

Model-scoped runtime configuration for agent runs

CLI Backend Protocol

How CLI backends plug into the Agent API

Claude Code

The flagship CLI backend — Claude Pro / Max subscriptions