# How to Run Background Agents

Source: https://www.omnara.com/guides/background-agents
Author: Kartik Sarangmath
Published: 2026-10-31

A background agent works while nobody watches it. An event starts it, such as a mention in Slack, a pull request opening on GitHub, a schedule, a webhook, or an API call from your own app.

It runs for minutes or hours and uses a machine that has the repository or data it needs. Then it reports back with a pull request, a message, a file, or a webhook to your backend. The person who started it moves on and comes back to the result.

Besides calling a model, a background agent needs something to start the run and give it a machine. It also has to survive crashes and deploys, work with limited access, pause for approvals, and deliver the result.

## The Short Version

| If you want | Use |
| --- | --- |
| Background agents of any kind, started from your app, Slack, Discord, GitHub, or a schedule, on any model, on Omnara Cloud or self-hosted | Omnara |
| Coding agents your own app launches that open pull requests, on any model, using any machine | Omnara |
| Issue-to-pull-request help for your own engineers, on a plan you already pay for | Cursor, GitHub Copilot, or Devin |
| To automate your own personal account | Codex cloud, Claude Code on the web, or Jules |
| A prototype on one lab's models, with the lab running the agent and keeping its transcripts | Claude Managed Agents or OpenAI's Agents API |
| Durable jobs around an agent loop you've already written | Trigger.dev, Inngest, or Temporal |

## What a Background Agent Needs

- **A trigger.** Most teams want several, such as a Slack or Discord mention, a pull request, a cron schedule, and an API call from their own product. Each event should start one agent, even when the event is delivered twice.
- **A machine with the work on it.** A coding agent needs a fresh clone, the toolchain, and a shell. Other agents need a browser, a set of files, or a path into an internal network. Sandboxes suit disposable work, while your own servers suit anything only your network can reach.
- **Progress that survives crashes and deploys.** An hour-long run will meet a deploy, a worker restart, or a machine going away. Each finished step has to be saved outside the process, and recovery shouldn't repeat a push or a sent message.
- **Credentials scoped to the job.** The agent should reach the one repository or account the task needs. Stripe's coding agents [run on dev machines](https://stripe.dev/blog/minions-stripes-one-shot-end-to-end-coding-agents) cut off from production and the internet.
- **Approvals for risky steps.** Merging, deploying, or emailing a customer should wait for a person. That wait can last a weekend, so the pause has to outlive the process that asked.
- **A way to report back.** A pull request, a reply in the thread that started the run, a file, or a webhook. Webhooks can arrive twice or out of order, so the receiver deduplicates them.

## Omnara

[Omnara](https://github.com/omnara-ai/omnara) is the open-source managed agent platform for background agents of any kind, licensed under Apache 2.0.

- **Triggers.** Launch an agent from your app with an API call, from a Slack or Discord mention, or from GitHub when a pull request opens or someone mentions the bot. A cron trigger can also start a new agent, message an existing one, or open a new Slack or Discord thread. GitHub launches need a sender with write access, so an outside contributor's pull request can't start one.
- **Machines.** Agents run commands on Omnara's sandboxes, on sandboxes in your own account with providers like E2B, Daytona, and Modal, or on your own computers through a small daemon that only makes outbound connections. One agent can use several machines at once. If one goes offline, the agent keeps going, since it gets a retryable error and can move to another machine.
- **Durable progress.** Every step is saved to Postgres, so if a worker dies, another continues from the last saved step. Recovery [doesn't rerun tools](https://docs.omnara.com/agents/failure-handling), and a command keeps running on its machine when a worker dies. A tool call cut off by a crash comes back to the agent marked interrupted, with its outcome unknown, so the agent can check before trying again.
- **Scoped credentials.** Git credentials cover the repositories your GitHub App can reach, or a subset you list, and stay read-only unless you allow pushes. [MCP servers](https://docs.omnara.com/tools/mcp) are called from the workers that run the agent, so their credentials never reach the machines the agent uses.
- **Approvals.** A tool set to ask first pauses the agent until a person answers, however long that takes. The person can answer in the dashboard, through the API, or in the Slack or Discord thread.
- **Results.** The agent replies in its thread with messages and files, comments on its pull request, and sends event webhooks to your backend.

It works with any model from OpenAI, Anthropic, OpenRouter, Amazon Bedrock, or a compatible endpoint on your own keys, including models you host. You can [change a running agent's model, tools, permissions, or instructions](https://docs.omnara.com/events/sending-input#change-the-config-mid-conversation) through the API, and the change applies at its next model call without a restart.

Omnara Cloud has no platform fee, and you can [self-host](https://docs.omnara.com/self-hosting/deployment) all of it under Apache 2.0. Models bought through Omnara Cloud cost the provider's token rates, and its machines are billed by usage. Both are paid with credits that carry a 5% service fee covering provider costs.

For coding, the GitHub integration also gives agents tools for reading and reviewing pull requests. The [coding agent example](https://docs.omnara.com/examples/slack-coding-agent) works on a fresh clone and opens a pull request for a fix someone asks for in Slack or Discord. When someone mentions it on a pull request, it reviews or updates that pull request.

The example is modeled on the coding agent Omnara's team uses on its own repository, and it deploys from one prompt you give your coding agent.

Omnara runs its own agent loop instead of wrapping Claude Code or Codex. That lets one platform run your coding and non-coding agents with the same triggers, machines, and approvals.

On Terminal-Bench 4.0, Omnara matched the pass rates of Claude Code and Codex on the same models. It ran 12% faster than Claude Code and 11% cheaper than Codex. Its 69.6% with Claude Opus 5.5 is the top score. Terminal-Bench's own runner graded every run. [Every trace](https://terminal-bench.omnara.com/) and [the harness](https://github.com/omnara-ai/omnara-terminal-bench) are public, so you can rerun it yourself.

## Coding-Agent Products for Your Own Engineers

Cursor, GitHub Copilot, and Devin turn an issue or a request into a pull request for your own engineers. Each runs on the models its vendor offers, under its plans and account terms.

- **Cursor's [cloud agents](https://cursor.com/docs/cloud-agent)** start from Slack, GitHub, Linear, the web, or the [Cloud Agents API](https://cursor.com/docs/cloud-agent/api/endpoints), which is in beta. The API takes a prompt and a repository, streams progress, and can open a pull request when the run finishes. They run on Cursor's VMs or your own workers.
- **[GitHub Copilot's cloud agent](https://docs.github.com/en/copilot/concepts/agents/cloud-agent/about-cloud-agent)** has a tasks API [in public preview](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/cloud-agent/use-cloud-agent-via-the-api). It takes work from issues, Slack, Teams, and automations that run on a schedule or on repository events. It can investigate, make changes, and open pull requests.
- **[Devin](https://docs.devin.ai/)** takes tasks from Slack, Teams, Linear, Jira, its web app, and an API. It leaves draft pull requests for review.

The terms also decide who you can run them for. Devin's terms say ["for your internal business purposes only"](https://cognition.com/legal/platform-terms-of-service). Copilot's tasks API accepts only user tokens, so it acts as one person. Cursor's service accounts act as members of your own Cursor team.

[Cloud Agent APIs Compared](https://www.omnara.com/guides/cloud-agent-apis) goes through each API's accounts, terms, and webhooks.

Codex cloud, Claude Code on the web, and Jules do similar work under one person's account. Codex cloud has only an [experimental `codex cloud exec` command](https://learn.chatgpt.com/docs/developer-commands?surface=cli) for scripts. Claude Code on the web has an [experimental routines endpoint](https://platform.claude.com/docs/en/api/claude-code/routines-fire) that runs on your Claude subscription. Jules has an [API in alpha](https://developers.google.com/jules/api).

## Managed Agents From the Labs

[Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) and [OpenAI's Agents API](https://developers.openai.com/api/docs/guides/agents-api/overview) each run one lab's models and keep the transcripts with that lab. Both are in beta, and neither is eligible for Zero Data Retention. Pull requests need repository tools and credentials you set up yourself.

Claude Managed Agents runs Claude in a sandbox behind an API, built for "long-running tasks and asynchronous work." Sessions report back through a stream or signed webhooks, and they can run on a cron schedule through scheduled deployments.

OpenAI's Agents API runs the Codex harness the same way and reports back by stream or webhooks. Both can put the sandbox on your own infrastructure, while the lab keeps running the agent.

## Durable Job Platforms You Build On

Trigger.dev, Inngest, and Temporal run your own code durably, keeping it going through crashes, retries, and long waits. You write the agent and wire up its machine, repository access, and tools.

- **[Trigger.dev](https://trigger.dev/docs/introduction)** is an open-source platform for durable agents and workflows in TypeScript. Runs have no execution timeout. It has cron schedules and [waitpoint tokens](https://trigger.dev/docs/wait-for-token) that pause a run until a person approves.
- **[Inngest](https://www.inngest.com/docs/features/inngest-functions/steps-workflows)** saves each step's result and retries from the step that failed. [`step.waitForEvent`](https://www.inngest.com/docs/reference/functions/step-wait-for-event) holds a run for days while it waits on an approval.
- **[Temporal](https://docs.temporal.io/evaluate/understanding-temporal)** rebuilds a workflow from its event history on another worker after a crash. A workflow can wait for months. Its [OpenAI Agents SDK integration](https://docs.temporal.io/develop/python/integrations/openai-agents) runs each model call as a retried activity. It can also pause an action until a person approves.

Trigger.dev also offers agent sessions with approvals and a Slack integration, and Inngest has sandboxes in beta. You still put the pieces together in your own code.

## Which One to Use

For background agents people depend on, choose Omnara. It's one open-source platform for coding and non-coding agents alike, launched from your own app's API, Slack, Discord, GitHub, or cron. It runs any model on your own keys, so the agent isn't tied to one vendor's plans or terms.

A crash, a deploy, or a machine going offline doesn't lose the agent's saved history, and recovery doesn't rerun a push on its own. [Approvals](https://docs.omnara.com/events/interactions) wait as long as it takes, in the Slack or Discord thread or the dashboard.

Cursor, Copilot, and Devin are built around your own team's accounts, on their vendors' models and terms. Most of their APIs are in beta or preview. If your team already pays for one of them and only wants engineers' issues turned into pull requests, it covers that one job.

The labs' managed agents lock you to one lab's models and leave your transcripts with that lab. Trigger.dev, Inngest, and Temporal leave you writing the agent and wiring its machines and tools.

## FAQ

### What is a background agent?

An AI agent that runs without a person watching. An event starts it, such as a Slack mention, a pull request, a schedule, a webhook, or an API call from your app. It works for minutes or hours using a machine, then reports back with a pull request, a message, a file, or a webhook.

### What are the best platforms for running background agents?

Omnara runs background agents of any kind on any model. It's open source, and you can use Omnara Cloud or self-host it. For coding help limited to your own engineers, Cursor, GitHub Copilot, and Devin turn issues into pull requests on their own plans. Claude Managed Agents and OpenAI's Agents API run one lab's models, and Trigger.dev, Inngest, and Temporal run an agent you write.

### Which platforms let me run background coding agents in the cloud and trigger them from my own app?

Omnara launches a coding agent per API call on any model, and its GitHub integration provides Git credentials and pull request tools. Cursor's Cloud Agents API and GitHub Copilot's tasks API start coding agents in your own team's repositories. Cursor's API is in beta, and Copilot's is in preview. Devin's terms limit it to internal business use. Claude Managed Agents and OpenAI's Agents API can do coding work once you add repository tools and credentials.

### Can I run Claude Code or Codex as a background agent?

Under your own account, yes. Claude Code on the web and Codex cloud run tasks in the cloud, and both have experimental ways to start tasks from scripts.

For your users, Anthropic allows unmodified Claude Code in your product only if [each user signs in with their own Claude account, API key, or supported cloud provider credentials](https://code.claude.com/docs/en/legal-and-compliance) and pays for their own usage, unless you have a separate agreement. OpenAI's Agents API runs the Codex harness behind an API. Omnara runs its own agent loop instead, and it can run Claude or OpenAI models on your own keys.

### How do background agents survive crashes and deploys?

Their progress lives outside the process. Omnara saves every step to Postgres and continues the agent on another worker, without rerunning a tool that a crash cut off. Temporal and Inngest record each step of code you write and resume from it.
