Coding Agent Task Runner - Codex & OpenCode, Patch Out avatar

Coding Agent Task Runner - Codex & OpenCode, Patch Out

Pricing

from $20.00 / 1,000 task starts

Go to Apify Store
Coding Agent Task Runner - Codex & OpenCode, Patch Out

Coding Agent Task Runner - Codex & OpenCode, Patch Out

Give a repository and a task, get a patch, changed files, test results and the agent's summary in one call. Codex CLI or OpenCode, models through Apify's OpenRouter proxy, no API key of your own.

Pricing

from $20.00 / 1,000 task starts

Rating

0.0

(0)

Developer

Vadim Bezrukov

Vadim Bezrukov

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

12 days ago

Last modified

Features

Limited permissions

Share

Give it a Git repository and a task in plain words. The Actor clones the repository, runs a coding agent (OpenAI's Codex CLI or OpenCode) headless with a deadline, and returns:

  • patch.diff: a binary-safe git diff you can apply with git apply
  • the changed files, insertions and deletions
  • the result of your test command (npm test, pytest -q, ...) if you give one
  • the agent's own summary, its log and a status you can branch on

One call: task in, patch out. Models run through Apify's OpenRouter proxy, so you need no OpenAI, Anthropic or OpenRouter key of your own.

Try the prefill. It asks the agent to add a CONTRIBUTING.md to octocat/Hello-World. On our test runs Codex CLI with deepseek/deepseek-v4-flash finished in 7 to 14 seconds with 4 to 8 model requests and about $0.003 of tokens, and returned a two-file patch (new CONTRIBUTING.md, a link in the README). The whole run took 20 to 30 seconds and its Actor events come to $0.06.

Use it from n8n, Make or your own code

An agent run often takes longer than the 300 seconds a synchronous API call waits, so start the run asynchronously and wait for it:

  1. Trigger: for example a GitHub issue that gets the label agent.
  2. Start the run: Apify node "Run an Actor" (or
    POST https://api.apify.com/v2/acts/automa-flow~coding-agent-task-runner/runs?maxTotalChargeUsd=1
    ) with
    {"repoUrl": "https://github.com/you/repo", "task": "<issue title and body>", "testCommand": "npm test"}
    .
  3. Wait: Apify node "Wait for run to finish", or poll GET /v2/actor-runs/{runId} every 30 seconds until the run is no longer RUNNING.
  4. Branch on the row: read the one Dataset item; status is DONE, NO_CHANGES, TIMEOUT, ... and testsPassed tells you whether your tests passed.
  5. Use the patch: fetch patch.diff from the run's Key-Value Store (
    GET /v2/key-value-stores/{defaultKeyValueStoreId}/records/patch.diff
    ). Post it as an issue comment for review, or send it to a GitHub Actions workflow (repository_dispatch) that runs git apply and gh pr create.

The Actor never pushes to your repository and never opens pull requests: you decide what happens with the patch.

Pricing

Pay per event, Apify platform usage included:

EventPriceWhen
Actor start$0.0003 per GB of memoryeach run (2 GB default: $0.0006)
Task start$0.02once, when the agent starts and the model answers
Agent minute$0.04each started minute of agent plus test time, 2 GB included
Extra GB-minute$0.01each started GB-minute above 2 GB (4 GB adds $0.02 a minute)

Nothing past the start event is charged when the input is invalid, the clone fails, the model is refused, the proxy is down or the budget cannot cover one minute. Retries and time after the deadline are never charged.

Model tokens are billed separately by Apify's OpenRouter proxy, on your Apify account at the provider's price. The row shows tokenCostUsd as the proxy reported it. Your maxTotalChargeUsd limits this Actor's events, not tokens: maxModelRequests is what bounds your token bill.

Example bills at 2 GB:

  • the prefill (1 minute): $0.06 plus about $0.003 of tokens
  • a 10-minute task: $0.42 plus tokens (cheap models: cents; frontier models: dollars)
  • 100 such tasks a month: about $42 plus tokens

A small maxTotalChargeUsd shortens the agent's deadline to the minutes it covers, and the run says so in RUN_SUMMARY. One minute with its start events costs $0.061 at 2 GB, $0.082 at 4 GB and $0.123 at 8 GB; a lower cap ends in BUDGET_EXCEEDED before any work.

Input

FieldWhat it does
repoUrlhttps:// clone URL. SSH, git@, file: and URLs with a token inside are refused.
taskWhat to change, 10-8,000 characters, for example an issue body.
agentcodex (default) or opencode. With the default model Codex is the more reliable: in our tests OpenCode stopped early without changes in 3 of 9 runs (NO_CHANGES, charged).
modelOpenRouter model ID, default deepseek/deepseek-v4-flash.
gitRefBranch, tag or 40-character commit SHA. Default: the default branch.
gitTokenRead token for a private repository. Used for the clone only.
testCommandShell command run with bash -lc after the agent, up to 500 characters.
testTimeoutSeconds10-1,800, default 300. Counts toward agent minutes.
maxMinutesAgent deadline, 1-60, default 10.
maxModelRequestsModel calls allowed, 1-2,000, default 200.
includeUntrackedInclude new files in the patch (default on).
failRunOnErrorEnd the run FAILED when the status is not DONE or NO_CHANGES.
secretsEnvironment variables for the agent and the tests, for example a registry token.

Output

One Dataset row per run (views: Overview and Details). Abridged, from a test run of the prefill:

{
"status": "DONE",
"message": "The agent changed 2 files.",
"repoUrl": "https://github.com/octocat/Hello-World",
"gitRef": "master",
"baseCommit": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
"agent": "codex",
"agentVersion": "codex-cli 0.167.0",
"model": "deepseek/deepseek-v4-flash",
"filesChanged": 2,
"insertions": 9,
"deletions": 0,
"changedFiles": ["CONTRIBUTING.md", "README"],
"skippedLargeFiles": [],
"patchKey": "patch.diff",
"patchBytes": 895,
"testCommand": null,
"testsPassed": null,
"agentSummary": "Created CONTRIBUTING.md with three bullet points and added a link to it at the bottom of the README.",
"agentMinutes": 1,
"modelRequests": 8,
"promptTokens": 75028,
"completionTokens": 990,
"tokenCostUsd": 0.002634,
"fingerprint": "67104d66b493041387daacba4f8a221e2c90148c0e88aa16d805ec3c487148cb"
}

The Key-Value Store holds patch.diff, agent-log.txt and test-log.txt (redacted, at most 1 MiB each), RUN_SUMMARY (the row plus phases, durations, model request counts, charged events and CLI versions) and BILLING_RECEIPT.

Statuses

StatusMeaningCharged
DONEThe patch is not empty. Failing tests still give DONE with testsPassed: false.yes
NO_CHANGESThe agent finished without changing files.yes
AGENT_FAILEDThe agent exited with an error and changed nothing, or got no model answer in 5 minutes and was stopped.if the model answered
TIMEOUTThe deadline was reached; the patch so far is returned.yes
REQUEST_LIMITmaxModelRequests was used up; the patch so far is returned.yes
MODEL_UNAVAILABLEThe proxy refuses the model.no
PROXY_FAILEDThe model proxy did not answer.no
REPO_NOT_FOUNDWrong URL or ref, or a private repository without a token.no
REPO_AUTH_FAILEDThe git host refused the token.no
REPO_TOO_LARGEOver 500 MiB or 50,000 files after the clone.no
REPO_UNAVAILABLEThe git host did not answer after 3 attempts.no
INPUT_INVALIDAn input field is wrong; the run fails.no
BUDGET_EXCEEDEDmaxTotalChargeUsd cannot cover one agent minute; the run fails.no

Every other status writes the row and ends the run normally, so a pipeline can branch on status. Turn on failRunOnError if you want a failed run instead.

Security model and privacy

The agent approves every command it decides to run, and a task or repository can come from someone you do not trust. The Actor protects what matters to you:

  • The agent and the test command run as an unprivileged user with an environment built from scratch: no Apify token, no proxy password, no gitToken, no APIFY_* variable.
  • Model calls go through a local forwarder that adds your Apify token itself, allows only the model endpoints and stops at maxModelRequests and at the deadline. The model provider comes from the run: an opencode.json or .codex/config.toml in the repository cannot point the agent elsewhere.
  • gitToken is used for the clone only and is never written to .git/config.
  • Every secret value is removed from logs, the row and the KVS files, also in its URL and base64 forms. The task text is never logged (only its length and hash).
  • At the deadline the agent's whole process group is stopped and every leftover process of the sandbox user is killed.

This is a container, not a virtual machine. Outbound network stays open, so the agent and your tests can install packages. Put only the secrets your tests need into secrets.

Privacy: the repository content and the task are sent to the chosen model provider through OpenRouter. Do not run it on code you may not share with that provider.

Limits

  • One repository and one task per run; agent deadline up to 60 minutes.
  • Repository up to 500 MiB and 50,000 files after a shallow clone.
  • Files over 5 MiB are left out of patch.diff and listed in skippedLargeFiles; a patch over 8 MiB is not stored.
  • The image has git, ripgrep, Node.js 22 and Python 3.12. Other toolchains can be installed by the test command or the agent at run time.
  • Memory 2-8 GB (default 2 GB). Bigger builds need more memory, which adds extra GB-minutes.
  • No pushing, no pull requests, no interactive sessions.

Use it from an AI agent (MCP)

Add the Actor as a tool through Apify's MCP server: https://mcp.apify.com?tools=automa-flow/coding-agent-task-runner. An assistant can then hand a coding task to a separate agent, wait for the run and read status, changedFiles, testsPassed and patch.diff before it decides what to do next. Set maxModelRequests and maxTotalChargeUsd in the call to bound the bill.

If a run fails or looks wrong, open an Issue and include the run URL. Release notes are in the changelog.