Skip to main content

Live execution

A live run calls a model on your workspace's own provider key, edits code in a working tree on the engine, pushes one branch to your repository and opens a draft pull request. It costs money, and it writes into a repository you care about. Turning it on is an operator's decision; this page is what you need to make it.

Prerequisites​

Before a first loop starts, Ouroboros checks each of these for the repository and workflow it is about to run. The Get Started wizard shows the list as Ready to run?, and GET /api/v1/loop/readiness?repository=<owner/name>&workflow=<slug> answers it as JSON — each check with its state (pass, fail or unknown), a reason and a link to where it is fixed. A loop is ready only when every check passes; an unknown blocks like a failure.

CheckWhat must be true
deploymentOURO_LIVE_EXECUTION_ENABLED is true — see Turning it on.
workspaceThe workspace is active, not paused or pending deletion.
provider_connectionAn enabled provider connection that may run a loop exists and passed its last test — see Providers § Which connections can run a loop.
routesEvery task kind the workflow uses resolves to a model, and that model has a price, so the run's spend can be capped.
stage_executorsThe engine has a stage executor registered for the workflow's model stages — see Stage executors.
runnerEach build stage names a runner pool, and that pool has a runner online that can check out the repository — see Build farm.
build_commandEach build stage has a command to run: its own Command, or else its pool's default command — the same rule a build follows when it is submitted. With neither, the check fails build_command_required, and its link opens the stage in the Studio to set one.
repositoryThe repository is enabled for the loop.
push_credentialThe workspace's GitHub token may push to the repository.
pull_request_credentialThe GitHub source that mirrors the issue may open a pull request in the repository.
dry_runThe repository is in dry-run — see Policies § Dry-run.
workflow_publishedThe workflow has a published version that reads.
concurrencyA live-run slot is free under the workspace's ceiling — see Limits.
The build_command check failing: the build stage sets no command and has no pool default to fall back on, with its fix link to the stage.
One failed row of the Ready to run? card: ✗ The build stage build sets no command, and names no pool to default from., with the link Workflow · set the stage's build command →.One failed row of the Ready to run? card: ✗ The build stage build sets no command, and names no pool to default from., with the link Workflow · set the stage's build command →.

GitHub answers the two permission checks with what the token's account may do, not the token's own scopes: a passing check confirms what GitHub can say and no more.

Step 4 with live execution off: the configuration is saved, the switch is an administrator's, and Finish setup queues the issue.
The Ready to run? card on step 4 for acme-robotics/helios-firmware, issue #488 sized XS: a notice reading Your configuration is saved, naming OURO_LIVE_EXECUTION_ENABLED as an administrator's switch with How live execution is turned on; 5 checks passed with a show toggle; seven failed checks each with a fix link — no provider connection, no route for analyze, plan and implement, no stage executor, the build stage's workspace default pool does not exist, the build stage sets no command and names no pool to default from, no GitHub token, the token cannot read the repository; the dry-run line and the labelled Estimate.The Ready to run? card on step 4 for acme-robotics/helios-firmware, issue #488 sized XS: a notice reading Your configuration is saved, naming OURO_LIVE_EXECUTION_ENABLED as an administrator's switch with How live execution is turned on; 5 checks passed with a show toggle; seven failed checks each with a fix link — no provider connection, no route for analyze, plan and implement, no stage executor, the build stage's workspace default pool does not exist, the build stage sets no command and names no pool to default from, no GitHub token, the token cannot read the repository; the dry-run line and the labelled Estimate.

The wizard's Ready to run? card while the switch is off. The checks read only: none calls a model or starts a job, so they are safe to ask as often as you like.

Turning it on​

Three things, on the deployment:

  1. The switch. Set OURO_LIVE_EXECUTION_ENABLED to true on the REST service and restart it. Off — the default — no queued issue becomes a live run, whatever else is ready, so an upgrade never starts executing on its own.
  2. The engine's way back to Ouroboros. Set OURO_REST_URL on the engine to the REST service's internal address (http://rest:4000 in the compose file). The engine claims work, reports progress and sends every model call through it. Without it the engine registers no stage executor and logs no REST URL is configured: no harness executor.
  3. The run volume. Mount a volume at /var/lib/ouroboros-engine/runs and set OURO_ENGINE_RUN_DIR to it, beside the clones volume at OURO_ENGINE_CLONE_DIR. Each live run gets its own working tree there. Allow at least OURO_ENGINE_RUN_MAX_MB (2048 MB unless set) free per run you let run at once — see Disk and cleanup.

The harness runtime is already in the engine image. The stage executor runs the Claude Agent runtime bundled with the image (about 255 MB of it); nothing else is installed. The image's health check fails if that runtime is missing.

Then check it took:

  • The engine's GET /v0/status lists harness under executors.
  • The wizard's Ready to run? card, or the readiness route above, passes for the repository you want to start with. This is the check to trust.
  • GET /api/v1/loop/capabilities lists each stage of the loop and, when one is not live, a reason. Execution is live when the engine reports a task queue and a stage executor.

What the loop can do​

Exactly this, and nothing else:

  • It edits files in one working tree — the run's own, on the engine. It may read, search, edit and write files there. Paths outside the tree, through .git, onto a protected path, or into CI configuration without the stage's permission are refused.
  • It pushes one branch — ouro/run-<run id>-<issue number>, fast-forward only — see What Ouroboros writes to your repository.
  • It opens one draft pull request for that branch. While dry-run is on, Ouroboros refuses to merge it.

It has no shell, no network access of its own — no web tool, no sub-agents, no MCP servers — and it loads nothing from the repository's agent settings: settings, hooks and skills in the repository's .claude/ directory are ignored. Its instructions come only from the workflow's stage prompts.

What it cannot protect you from​

These are as real as the protections above. Read them before turning the switch on.

  • Issue text is untrusted input. The issue's title, body and acceptance criteria are passed to the model as data, not instructions. That limits prompt injection; it does not rule it out. A crafted issue can still steer what the loop writes inside the working tree.
  • A failed build's output is untrusted input too. When a gate sends the run back to a stage because a build failed, that stage's next attempt is told which check failed and the last lines of the build's log (at most 60 lines and 6,000 characters, already redacted), and the run's transcript says it did. The stage is told to treat that output as data, but a repository's build can print anything.
  • The draft pull request is a contribution like any other. It can contain wrong, insecure or deliberately harmful code. Read it — diff and checks — the way you would read a stranger's pull request before you merge it. Dry-run keeps it a draft so that you do.
  • Build stages run your repository's build on your runners. A build stage checks out the run's changes and runs the repository's command on a runner in your farm. The loop's code executes on that machine.
  • Some protections do not exist yet. There is no network egress control for the engine or the runners, no gate that asks a person before a destructive change, no automatic scan of what a run wrote for threats, and pushed commits are not signed. These are planned in the agent runtime security roadmap.

A person still chooses every live run: an issue starts only once someone who holds Can approve loops has confirmed it — see Who may start a live run.

Credentials​

  • The provider key stays in the control plane. The engine and the agent never hold it. For each stage attempt the engine is given a short-lived credential for that run and stage; every model call goes through Ouroboros, which routes it to your connection, applies the run's spend cap, records the usage, and revokes the credential when the attempt ends.
  • The GitHub credential is handed over per call. The workspace's GitHub token is given to the engine for one push at a time and used in memory. It is never written to the working tree, its git configuration, the process list or the logs. The pull request is opened by Ouroboros itself, with the token of the GitHub source that mirrors the issue.
  • A subscription credential is refused. A claude.ai subscription or session token is refused when it is connected (provider_credential_refused); a loop runs only on an API key your workspace pays for — see Providers § Which connections can run a loop.

The admission check​

The engine asks for work by claiming the next item in a workspace's queue. Ouroboros decides the claim in one place, every time, against this list:

Holds the whole workspaceHolds one issue
The deployment's switch, OURO_LIVE_EXECUTION_ENABLED, is on.Its repository is enabled.
The workspace is not paused or pending deletion.Its repository is in dry-run — see Policies § Dry-run.
The engine has at least one stage executor registered.Its workflow version is published.
Fewer live runs are going than the workspace's ceiling.Every route its workflow uses reaches a provider connection that may be invoked.
Someone with loop approval has confirmed it.

If a workspace-wide condition fails, nothing in the queue starts. If one issue's condition fails, the engine skips that issue and takes the next one that passes. The skipped issue keeps its place in the queue.

Nothing waits silently. Wherever a queued issue is shown, on the dashboard's Up next in queue card and on the Issues screen, it shows the reason it is waiting. Workspace-wide reasons appear once, above the queue. See Issues § Why a queued issue is waiting for each reason and its fix.

Who may start a live run​

A live run is started only by a person who holds Can approve loops (see Roles & capabilities). Nothing picks work up on its own:

  • When live execution is on and a person who can approve loops queues an issue, it is confirmed as it is queued.
  • Anything else waits as Needs confirmation until such a person confirms it with Confirm for live run in the issue's detail panel. This covers an issue queued by a member without the capability, by a playbook, by a chat command or by Get Started. It also covers every issue queued before live execution was turned on, including issues queued long ago to try out the product.

Each confirmation is recorded in the audit log as queue_item.confirmed.

Limits​

The concurrency ceiling​

A workspace runs one live run at a time unless an owner or admin raises its ceiling. Issues beyond the ceiling wait as Waiting for a slot. An issue the engine has claimed but not yet started also takes a slot. Two engine workers claiming at the same moment cannot both take the last slot.

The ceiling can never be higher than the deployment's maximum, OURO_LIVE_RUN_CEILING_MAX (4 unless set). Read and set it through the API. Changing it is recorded as workspace.live_ceiling_changed.

# Read the ceiling, the deployment's maximum and the run limits.
curl -H "Cookie: $SESSION" https://ouroboros.example.com/api/v1/settings/live-execution

# Raise the ceiling to 2 (owner or admin).
curl -X PATCH -H "Cookie: $SESSION" -H "Content-Type: application/json" \
-d '{"ceiling": 2}' https://ouroboros.example.com/api/v1/settings/live-execution

A ceiling above the deployment's maximum is refused with live_ceiling_above_max.

Run limits​

Ouroboros checks every minute for live runs that have passed a limit, and aborts them:

LimitVariableDefault
Wall clock — how long a live run may go onOURO_LIVE_RUN_WALL_CLOCK_MINUTES120 minutes
No progress — how long a live run may go without reporting anythingOURO_LIVE_RUN_NO_PROGRESS_MINUTES15 minutes

The abort goes through the run's control queue like any other abort. The engine cleans up, the branch is kept, and the run console says which limit stopped the run. The cap on what a run may spend is set separately, by the route and the policy's spend guard — see Policies & guardrails. A run that reaches its cap is stopped the same way.

Aborting a run​

To stop one live run for good, open it in the run console and choose Abort run — see The run console § Controlling a live run. The branch is kept. To stop everything in a workspace at once, pause it — see Pausing.

Stage executors​

A live run's model stages are carried out by a stage executor. This version has one: the Claude Agent executor, which runs a stage as an agent that reads the repository, edits files and iterates until the stage is done.

It runs on your workspace's own API key. The agent never holds a provider key. For each stage attempt the engine mints a short-lived credential for that run and stage, and the agent sends every model call through Ouroboros. Ouroboros routes the call to an Anthropic connection under Models › Providers & keys, applies the run's spend cap, and records the usage against the run. When the attempt ends, the credential is revoked. A stage whose routed model has no Anthropic connection cannot run on this executor.

What it cannot do:

  • Only file tools. It may read, search, edit and write files. It has no shell, no web access, no sub-agents and no MCP servers. A request for any other tool is refused.
  • Only the run's working tree. Every path is checked before the tool runs. A path outside the tree, through .git, onto a protected path, or into CI configuration without the stage's May touch CI config permission is refused, the tool does not run, and the stage stops. See Policies & guardrails.
  • Nothing from the repository configures it. Settings, hooks and skills in the repository's .claude/ directory are not loaded.
  • The issue is data, not instructions. The issue's title, body and acceptance criteria are passed to the agent as untrusted data. Its instructions come only from the stage's prompt in the workflow. This limits prompt injection but cannot rule it out, which is why the agent has nothing else to use.
  • It fails closed. If the permission check itself fails or takes too long, the tool is not run and the stage stops.

When it is available. The executor is part of the engine image. The engine registers it at startup, and GET /v0/status on the engine lists it under executors as harness. An image without it fails its health check. Live runs still need the deployment's switch, OURO_LIVE_EXECUTION_ENABLED; see The admission check.

After an engine restart a stage on this executor continues its agent session from where it was stopped, using session files kept beside the run's working tree under OURO_ENGINE_RUN_DIR. If the session cannot be continued, the stage starts again as its next attempt. See Recovery after an engine restart.

What Ouroboros writes to your repository​

A live run writes to your repository in one way only: it pushes one branch, ouro/run-<run id>-<issue number>, fast-forward only. It never force-pushes, never deletes the branch, and never pushes to the default branch or to a branch your host protects.

When it pushes. When the run reaches a build stage, so the build runs on the run's own changes, and when it reaches its pull-request stage. A correction round — a failed build sent back to the implement stage — adds commits on top of the ones already pushed.

What the commits say. One commit per stage attempt that changed files. The author and committer are the deployment's Ouroboros identity, set by OURO_ENGINE_COMMIT_AUTHOR_NAME and OURO_ENGINE_COMMIT_AUTHOR_EMAIL. The person who confirmed the live run is named in a Co-authored-by: trailer. Every message states that an automated loop generated the change and carries Ouroboros-Run:, Ouroboros-Workflow:, Ouroboros-Model: and Ouroboros-Stage: trailers. Commits are not signed. The loop's branch on your host shows a commit's parts.

What is refused before anything is sent. Ouroboros checks every push before it hands over a credential, and refuses:

  • a force push;
  • a branch that is not the run's own, or one outside ouro/run-*;
  • the repository's default branch;
  • a branch your host reports as protected;
  • changes the guardrails have not evaluated for the run's current changes, or that a guardrail in block mode failed;
  • a workspace with no GitHub credential.

The engine refuses, on its side, a push of more than one ref, a forced ref, or any ref outside refs/heads/ouro/run-.

The credential. The workspace's GitHub token is handed to the engine for that one push and used in memory. It is never written to the run's working tree, its git configuration, the process list or the logs.

When the host refuses. A push your host refuses — permissions, branch protection, the network — ends the stage with the host's own reason. The working tree is kept, so the run can be retried.

The audit trail. Two events are recorded for every push, both naming the run and the person who started it: run.push_granted when the credential is handed over, and run.branch_pushed with the outcome.

Recovery after an engine restart​

A live run survives the engine stopping part-way through:

  • The engine reports a heartbeat for each run it executes, every OURO_ENGINE_HEARTBEAT_SECONDS seconds (5 unless set).
  • Ouroboros checks for quiet runs every OURO_RUN_SUPERVISOR_TICK_SECONDS seconds. A run with no heartbeat for OURO_RUN_HEARTBEAT_STALE_SECONDS seconds (30 unless set) is handed to the engine again. So is a run that was opened but never started. Recovery therefore takes about half a minute.
  • The run resumes from its last checkpoint. The engine saves the run's position after every stage. The interrupted stage starts again as its next attempt, and the working tree is put back to how the last completed stage left it (see Disk and cleanup).
  • A stale engine cannot write. Each time a run is handed to an engine, the run's epoch goes up. Anything the old engine still sends is refused, and it stops.

The same check also hands queued issues to the engine. While live execution is on, each workspace with a confirmed issue waiting is offered to the engine on every check. The engine claims an issue only when it has a stage executor registered for it.

Disk and cleanup​

The engine gives every live run its own working tree to edit, under OURO_ENGINE_RUN_DIR:

  • One tree per run, never shared. Two runs on the same repository have two trees and never see each other's files. A tree is open in one engine at a time.
  • Made from the clone the engine already keeps. The tree is checked out at the run's base commit, on a branch named ouro/run-<run id>-<issue number>. It borrows git objects from the repository's clone under OURO_ENGINE_CLONE_DIR instead of copying them, so a run costs only its checkout and its edits. Keep both directories on volumes.
  • No credential is stored. The tree and its git configuration hold no token and no remote.
  • Confined. A tool may only touch paths inside the tree. Paths that leave it are refused: through .., an absolute path elsewhere, or a symbolic link that points out. So is any path through a .git directory.
  • Checkpointed. At each stage boundary the engine commits the tree on the run branch. The checkpoint is local only and never pushed as is: what is pushed is an attributed commit made from it (see What Ouroboros writes to your repository). If the engine stops mid-stage, the tree is put back at the last checkpoint when the run resumes. Half-written files from the stopped stage are dropped.
  • What the run console shows is what is on disk. The Changes card is the tree's own diff against the base commit. Untracked files count; files the repository ignores do not.

Trees are removed when they are no longer needed:

WhenWhat happens
The run ends — its branch is pushed at the pull-request stage, or the run is abandonedThe engine removes the tree. A push the host refused keeps it, for a retry.
The engine starts, and whenever a new run's tree is madeA sweep removes trees whose run has ended, trees left half-made by a crash, and trees nobody has opened for OURO_ENGINE_RUN_IDLE_HOURS hours. A tree that is open is never swept.

Set OURO_ENGINE_RUN_IDLE_HOURS longer than a run may wait on a person at a gate. A run whose tree was swept while it waited cannot resume its stage.

Two limits keep the run volume from filling:

  • Per run. A tree larger than OURO_ENGINE_RUN_MAX_MB, .git included, is refused at the next tool call or stage boundary. The error says how large the tree is.
  • Per volume. A new run is refused while the volume has less than OURO_ENGINE_RUN_MAX_MB free. The error says how much space is free and how much a run may need. Runs already going are not affected.

Pausing​

Pausing the workspace (Settings › Danger zone) has two effects:

  • New claims stop at once. Every queued issue shows Workspace paused.
  • Running live runs pause at their next safe boundary. Each one is sent a pause control. The current step finishes and nothing new starts.

Resuming the workspace resumes the runs the pause stopped. A run that a person paused stays paused.

Configuration​

VariableDefaultWhat it does
OURO_LIVE_EXECUTION_ENABLEDfalseThe deployment's switch. Off, no claim succeeds, whatever the queue holds.
OURO_LIVE_RUN_CEILING_MAX4The highest ceiling any workspace may set (1–100).
OURO_LIVE_RUN_WALL_CLOCK_MINUTES120The wall-clock limit (5–1440).
OURO_LIVE_RUN_NO_PROGRESS_MINUTES15The no-progress limit (2–360).
OURO_RUN_SUPERVISOR_TICK_SECONDS5How often quiet runs and claimable issues are checked for, in seconds (1–300).
OURO_RUN_HEARTBEAT_STALE_SECONDS30How long a run may go without a heartbeat before it is handed to the engine again (10–3600).
OURO_ENGINE_HEARTBEAT_SECONDS5How often the engine reports a running run's heartbeat (1–60). Keep it well under the stale limit.
OURO_ENGINE_WORKER_IDthe host nameThe name the engine claims issues and starts runs under.
OURO_REST_URL (engine)—The REST service's internal address, on the engine. Required for live execution: without it the engine registers no stage executor.
OURO_ENGINE_RUN_DIR<temp dir>/ouroboros-engine/runsWhere the engine keeps each run's working tree. Mount a volume there.
OURO_ENGINE_RUN_MAX_MB2048One tree's size limit in MB, and the free space a new run needs (16–1048576).
OURO_ENGINE_RUN_IDLE_HOURS168How long a tree may go unopened before the sweep removes it (1–8760).
OURO_ENGINE_COMMIT_AUTHOR_NAMEOuroborosThe name a run's pushed commits are authored and committed under.
OURO_ENGINE_COMMIT_AUTHOR_EMAILloop@ouroboros.invalidThe email address a run's pushed commits are authored and committed under.

The Configuration reference lists every variable.