Agent loops

how to set up your first ai agent loop

TL;DR

An agent loop is one agent that runs your workspace: it picks up work, creates a pane per feature, opens review and QA tabs in it, checks their output, answers their prompts and tells you what needs review. Pane gives that agent what it needs through the runpane CLI: saved repos, worktree-backed panes, terminals it can drive, an event stream, and short output reads that don't flood its context. It works with Codex, Claude Code, Aider, Goose or any CLI, on Windows, WSL, macOS and Linux. This page has a first-loop recipe and a starter prompt.

Instead of babysitting terminals, you have one agent that manages the workspace. It picks up work, creates a pane per feature, opens review and QA tabs in it, checks their output, sends follow-up input and tells you what needs review. Pane makes that work with any agent, on any OS.

Any agent

Codex, Claude Code, Aider, Goose, OpenCode or any terminal CLI.

Any OS

Windows, WSL, macOS, Linux, VMs and remote hosts.

Open source

AGPL-3.0. The app, CLI and orchestrator skills are all public.

The shape of a loop

Not a magic prompt: a small operating cycle of inspect, spawn, drive, watch, validate, report.

StepWhat the agent doesWhat Pane gives it
InspectRead issues, pull requests, CI or repo stateSaved repositories and existing panes
SpawnCreate a pane for each feature and tabs for its reviews and QAWorktree-backed panes and agent tabs
DriveStart agents, answer prompts, send inputTerminal-backed panels
WatchWake up when an agent finishes or gets stuckAn event stream: ready, blocked, stuck
ValidateRead recent output before claiming successShort, limited terminal reads
ReportSummarize what needs human reviewVisible panes, diffs, branches and statuses

First loop recipe

Install, discover, add the repo, create a pane per feature, check, continue.

  1. 1Install or update Pane

    Use the package-manager path so you and your agents rely on the same runpane command. Inside Pane's own terminals, runpane is already on the PATH.
    npx --yes runpane@latest
    pnpm dlx runpane@latest
    pipx run runpane
  2. 2Let the agent find Pane

    Have the agent check what commands exist. The summary is short by default; full details for one command load only when needed.
    curl -fsSL https://runpane.com/runpane-cli-contract.json
    runpane doctor --json
    runpane agent-context --json
    runpane agent-context --command "panes create" --json
  3. 3Add the repo if needed

    Don't assume Pane knows the repo. Check, then add it if it's missing.
    runpane repos list --json
    runpane repos add --path "$PWD" --yes --json
    runpane agents doctor --agent codex --repo active --json
  4. 4One pane per feature

    1 feature = 1 worktree = 1 branch = 1 Pane; reviews, audits, fixes and QA for it are tabs in that Pane. A pane is a git worktree, and creating one installs dependencies and often builds, so create one only when the work's branch has no pane yet. To find the pane for a PR, get its head branch, then check each pane's worktreePath from panes list:
    gh pr view <number> --json headRefName
    runpane panes list --repo active --json
    git -C <worktreePath> branch --show-current

    If no pane owns the branch, create one. Use a built-in agent or pass any terminal command.

    runpane panes create \
      --repo active \
      --name "issue-51-login" \
      --agent codex \
      --prompt "Implement issue #51. Open a PR when checks pass." \
      --source agent \
      --wait-ready \
      --yes \
      --json

    Every later agent for that feature opens as a new tab in its pane. Tabs share one checkout: only the implementer moves HEAD, and review, audit and QA tabs never run git checkout, reset or stash.

    runpane panels create \
      --pane <pane-id> \
      --agent codex \
      --initial-input "Review the PR from this branch. Run checks, summarize findings, and stop before merging." \
      --source agent \
      --no-focus \
      --wait-ready \
      --yes \
      --json
  5. 5Check what actually happened

    After creating a pane or tab, or sending input, verify it. screen shows what's on screen now; output gives scrollback; watch streams ready, blocked and stuck events so the loop wakes only when needed.
    runpane panes list --repo active --json
    runpane panels wait --panel <panel-id> --for ready --timeout-ms 30000 --json
    runpane panels screen --panel <panel-id> --limit 80 --json
    runpane panels output --panel <panel-id> --limit 200 --json
    runpane watch --follow --json
  6. 6Answer prompts and continue

    Use panels submit for ordinary follow-ups, panels submit-composer for Codex or Claude composer boxes, and panels input only for exact bytes such as Ctrl-C.
    runpane panels submit --panel <panel-id> --text "Continue with the review pass." --yes --json
    runpane panels submit-composer --panel <panel-id> --strategy auto --yes --json
    printf '\003' | runpane panels input --panel <panel-id> --input-file - --yes --json
    runpane panels wait --panel <panel-id> --for idle --timeout-ms 300000 --json

A starter prompt for your orchestrator

Give any shell-capable agent this prompt and it becomes your loop runner.

Give this to Codex, Claude Code or any agent that can run shell commands:

You are running an agent loop for this repo.
Every cycle:
1. Inspect GitHub issues and PRs that need action.
2. Fetch the public contract if needed, then run runpane doctor --json and runpane agent-context.
3. Make sure this repository is saved in Pane and the requested agent is runnable.
4. 1 feature = 1 worktree = 1 branch = 1 Pane; reviews, audits, fixes and QA for it are tabs in that Pane. Create a Pane only when the work's branch has no Pane yet. Find an existing Pane with runpane panes list --repo <repo> --json by matching the PR's head branch against git -C <worktreePath> branch --show-current.
5. Start the right terminal agent with a clear initial prompt. For a new Pane use runpane panes create --source agent --wait-ready. For a tab use runpane panels create --pane <id> --agent <agent> --initial-input "<prompt>" --source agent --no-focus --wait-ready --yes --json. Tabs share one checkout: only the implementer moves HEAD, and review, audit and QA tabs never git checkout, reset or stash.
6. Use panels wait and panels screen before claiming a pane or tab started correctly.
7. Send follow-up input with panels submit or submit-composer; use panels input only for exact bytes.
8. Report the panes and tabs created, what each is doing, and what needs human review.
Keep output brief. Do not merge without explicit human approval.

Or use a built-in loop

Pane Chat and Sessions are loop agents that ship with Pane.

If you don't want to set up your own runner, use Pane's. Pane Chat is a chat with Claude Code, Codex or Cursor that already knows the runpane commands and the orchestrator skill. Sessions are named, persistent versions with their own workspace. Both stop and ask before merging or deploying. Ask for unattended mode to let them resume a pane whose turn died from a sleep or network error.

Windows and WSL

From inside WSL, reach the Windows Pane through PowerShell.

Pane can run as a Windows app while your loop agent lives inside WSL. A Linux shell may not see the Windows Pane directly, so call runpane through PowerShell and pick the saved repo by name or id:

powershell.exe -NoProfile -Command \
  'Set-Location $env:TEMP; runpane repos list --json'
powershell.exe -NoProfile -Command \
  'Set-Location $env:TEMP; runpane panes create --repo "Pane" --name "loop-smoke" --agent codex --prompt "Say hello from this loop and wait." --source agent --wait-ready --yes --json'

Pane handles the workspace, not the world

Your agent still uses GitHub, MCP and trackers directly.

Pane gives your loop the workspace commands. Your agent still uses the GitHub CLI, MCP servers, Linear, Jira or anything else for the outside world, so you're not locked into one model, editor or host.

出典

訂正
間違っている点や古くなっている点があれば、教えてください。修正して、ページ上部の日付を更新します。 GitHubでissueを作成
出典

よくある質問

または
ダウンロード*
Windows SmartScreen の警告Pane は未署名のため、直接ダウンロードすると SmartScreen の警告が出ることがあります。 Pane は完全にオープンソースです。コードを確認したり、自分でビルドしたりできます。1. 「詳細情報」をクリック2. 「実行」をクリック3. インストールを続けるPowerShell からなら公式リリースを直接ダウンロードできます。ブラウザ経由で起きやすい問題もほぼ避けられます。npm グローバルインストール
PowerShell に貼り付けてください。Linux

著者 Parsa Khazaeepoul、Paneの共同創業者。 .