• Docs
  • Talk to an expert
Blog
Blog
BlogProductCase studiesNewsInsights
Blog

Best infrastructure for background AI agents (2026)

AI AgentsTask containers
16 November 2026
Share
This post is also available in German and in French.

Note: pricing and features may have changed since publication. Check each provider’s documentation for current details.

The best infrastructure for background AI agents depends on the agent's hardest requirement: recovering long runs, isolating untrusted code, or reaching application data. Most production setups combine two layers: an orchestrator and an execution environment.

  • Durable execution engines (Trigger.dev, Inngest, Temporal) handle retries, waits, and resumption.
  • Sandboxes (E2B, Modal, Vercel Sandbox) isolate model-generated code.
  • Managed agent runtimes (Amazon Bedrock AgentCore Runtime) suit teams standardized on one cloud.
  • Application platforms (Upsun Cloud) run the agent as an on-demand task container beside the application's databases and services.

 

What is a background AI agent?

Unlike a background job, which runs fixed steps, a background agent chooses its next step at runtime, so it needs limits on runtime, cost, and permissions. Its runs typically move from queued to running to waiting (on a tool, a model, or a person) and end as completed, failed, or cancelled.

The term covers two cases:

  • Agents inside a product or business process, such as overnight ticket triage, CRM enrichment, or incident log summaries. Most of this page covers this case.
  • Background coding agents, which turn an issue into a pull request. The section on background coding agents covers this case.

 

What infrastructure does a background AI agent need?

Key takeaway: A background agent needs seven things from its infrastructure, and no single category covers all seven equally well.

  1. Triggers: API calls, webhooks, schedules, queue messages, or events.
  2. Run duration: longer than a web request, from minutes to a day or more.
  3. Recovery: retries, checkpoints, or resumable workflows, with idempotent side effects.
  4. Waiting: pausing for a model, an event, or an approval without paying for idle compute.
  5. Data access: scoped connections to databases and APIs, ideally with short-lived credentials.
  6. Isolation: limits on what the agent's process can read, run, and reach.
  7. Observability: a record of each run's trigger, actions, duration, and cost in compute and tokens.

How do background agent platforms compare at a glance?

Platform

Type

Runs start from

Longest run

Recovery

Runs on

Upsun Cloud task containersApp platformAPI, CLI, Console24 h (default 1 h)Caller retriesContainers beside app services
Render WorkflowsApp platformSDK, API, CLI24 hRetries, step replayOn-demand Render instances
Trigger.devDurable engineSDK, schedulesNo default limitRetries, checkpointed waitsManaged or self-hosted workers
InngestDurable engineEvents, cron2 h per stepStep-level retriesYour own compute
TemporalDurable engineAPI, schedules, signalsNo default limitEvent-history replayYour own workers
Cloudflare WorkflowsDurable engineAPI, Worker bindingsNo wall-clock limit per stepStep retriesCloudflare Workers
Vercel Workflow and SandboxDurable engine plus sandboxFunction calls24 h (Sandbox, Pro)Step checkpointsFirecracker microVMs
ModalServerless computeSDK, schedules, web endpoints24 hConfigurable retriesModal containers, GPUs
E2BSandboxSDK24 h (Pro), 1 h (Hobby)Pause and resumeFirecracker microVMs
Amazon Bedrock AgentCore RuntimeManaged runtimeInvoke API8 h per sessionNew session at limitMicroVM per session
Google Cloud Run jobsBatch computeAPI, scheduler168 h (1 h with GPUs)Up to 10 retriesCloud Run containers
LangSmith DeploymentFramework runtimeAPI, cron, webhooks1 h default, configurablePer-step checkpointsCloud, hybrid, or self-hosted

 

What are the main types of infrastructure for background AI agents?

Durable execution engines

Temporal, Inngest, Cloudflare Workflows, and Vercel Workflow save each completed step, so a retried run skips work it already finished. Trigger.dev checkpoints a run while it waits, but a retry re-runs the task from the start unless the work is split into subtasks with idempotency keys.

The trade-off: the engine tracks progress, but the team still decides where the agent runs and how it reaches application data.

Sandboxes and serverless compute

E2B and Vercel Sandbox run each sandbox in its own Firecracker microVM, and Modal adds GPU options. 

The trade-off: each sandbox starts without the application's data, so database and service access has to be wired in and maintained.

Managed agent runtimes

Amazon Bedrock AgentCore Runtime, LangSmith Deployment (formerly LangGraph Platform), and Google Cloud Run jobs host the agent inside one cloud's or one framework's ecosystem.

 The trade-off: when agents and applications sit on different providers, each accumulates its own pipeline, runbook, and audit process.

Application platforms

Upsun Cloud and Render run the agent as another workload beside the application. Render Workflows, launched in April 2026, adds durable tasks with retries and step replay.

The trade-off: isolation, GPU support, and built-in recovery vary by platform.

What happens when a background agent fails, times out, or the platform redeploys?

Temporal, Inngest, and Render Workflows replay a failed run and reuse the steps it already completed. Trigger.dev, Google Cloud Run jobs, and Modal retry a failed attempt from the start, up to a configured count. Upsun Cloud does not retry tasks and cancels running tasks before a deploy on the same environment, so an agent there should catch SIGTERM, save progress to a service such as PostgreSQL, and let the caller start a new run. 

On any platform, split the work into steps that record their results, keep state in a database rather than on local disk, and set a timeout close to the expected duration so a looping agent stops early.

How does a background agent wait for a human or an external event?

Inngest's step.waitForEvent, Cloudflare Workflows' step.waitForEvent, and Trigger.dev's waits pause a run without holding compute. On Upsun Cloud, where tasks cannot receive inbound traffic, the agent saves its proposed action to a service and exits, and a webhook or app action starts a follow-up task with the approval as a run-time variable.

How should a background AI agent be isolated and connected to data?

E2B and Vercel Sandbox give each sandbox its own Firecracker microVM, Amazon Bedrock AgentCore Runtime gives each session a dedicated microVM, and AgentCore Identity manages outbound credentials.

Upsun Cloud tasks run in the same Linux containers as applications, with namespace isolation, capability dropping, a seccomp profile, cgroup limits, and network isolation. Upsun recommends running bubblewrap inside the task for untrusted code; it is not built in, and egress scoping is not yet available.

For data access, a task declares relationships only to the services it needs, model keys arrive as sensitive environment variables through Upsun's secrets and environment configuration, and calls to the Upsun API use workload-authorization tokens that last 60 to 900 seconds. Any agent that reads tickets, emails, or web pages can be steered by prompt injection, so scoped credentials are the main limit on what a steered agent can do.

What does it cost to run a background AI agent?

Always-on workers bill while they wait. Run-to-completion compute (Upsun Cloud task containers, Render Workflows, Modal, E2B, Google Cloud Run jobs) bills per second only while a run is active. Trigger.dev does not bill compute while a run is checkpointed, and Cloudflare Workflows charges no CPU time while a run sleeps or waits, although each step is billed. 

Upsun Cloud bills tasks per second at application CPU and memory rates, listed on the Upsun pricing page, and does not track token spend, so teams log tokens per run in their own code. 

How does Upsun Cloud run background AI agents?

A task is declared under tasks: beside applications: and services:, with its own image, build, and command. It starts on demand, runs that command, and is removed when the command exits. Task containers became generally available on 12 August 2026 and are available on every Upsun Cloud project. 

  • Triggers: the Console, the CLI (upsun task:run), the API, or app code with a short-lived token. Webhooks and schedules go through a handler or cron that calls the API.
  • Data access: relationships to the same PostgreSQL, Redis, or other services the application uses.
  • Concurrency: three parallel runs by default, with extra triggers queued rather than dropped (lower on trials).
  • Run records: an activity ID, a status, streamed logs, and an API cancel endpoint for every run.
  • Any framework, any model provider: agents call external model APIs.

Upsun Cloud regions run on AWS, Google Cloud, Azure, and OVHcloud, with IBM Cloud available through the IBM Cloud marketplace, all under one workflow. Teams whose applications and agents are spread across providers get consistent configuration and audit evidence without manually reconciling separate consoles. 

Upsun holds ISO 27001 certification, a SOC 2 Type 2 report, and PCI DSS Level 1 compliance for its regions on AWS, Azure, and Google Cloud; the OVHcloud region is excluded, and HIPAA workloads run only in the US-4 region. Every Git branch can have its own environment, so a new agent version can run on a branch before it reaches production. 

What Upsun Cloud does not do for background agents

  • No GPUs or model hosting.
  • No built-in retries or checkpoints; the caller retries.
  • No runs longer than 24 hours.
  • No running tasks kept through a deploy on the same environment.
  • No inbound traffic to tasks; results are pushed out.
  • No microVM isolation or egress scoping yet.
  • No agent traces; prompts and tool calls are logged in the agent's own code.

Upsun Cloud fits agents that belong to an application, need its data, deploy with it, and finish within a day. For longer workflows, a durable engine can sit on top, because Temporal workers and Inngest functions run on infrastructure the team chooses. 

What infrastructure do background coding agents need, and where does Upsun Dispatch fit?

Products in this category include OpenAI Codex cloud, Cursor Cloud Agents (formerly called background agents), the GitHub Copilot coding agent, and Ona. They differ mainly in where the agent's environment runs, what starts a run, and how review works. 

Upsun Dispatch connects to GitHub, Jira, Linear, and GitLab. Mentioning @upsun-dispatch implement on an issue starts a run that plans, writes, and self-reviews changes, then opens a linked pull request; @upsun-dispatch review or a push leaves inline review comments. Every run is recorded in the Dispatch console for the whole organization, and a person owns the merge, because agents cannot merge, deploy, or read secrets. 

Which infrastructure is the right call for each background agent?

Use case

Consider

Runs many multi-step jobs with long waitsTrigger.dev, Inngest
Must survive failures across daysTemporal
Executes untrusted, model-generated codeE2B, Vercel Sandbox, Modal
Needs GPUsModal, Google Cloud Run jobs
Runs in an AWS-standardized organizationAmazon Bedrock AgentCore Runtime
Is built on LangGraphLangSmith Deployment
Is one of many mostly idle, stateful agentsCloudflare Agents and Workflows
Already deploys on VercelVercel Workflow and Sandbox
Uses the app's own database and finishes within 24 hoursUpsun Cloud task containers
Works on your repositories with human reviewUpsun Dispatch, Codex cloud, Copilot coding agent

Frequently asked questions

Do background AI agents need durable execution?

Background agents need durable execution when runs are long, wait on people or external events, or have side effects that must not repeat. Short runs that can restart from scratch at low cost can run on run-to-completion compute, as long as state is written to a database and actions are idempotent.

Can background AI agents run on serverless functions?

Serverless functions suit only short agent runs, because each invocation has a maximum duration; Vercel Functions, for example, default to 300 seconds. Longer agents run better on a durable engine, a sandbox, a managed runtime, or run-to-completion containers, with the function only starting the run.

How long can an AI agent run in the background?

As of 9 November 2026, published single-run limits range from 8 hours (Amazon Bedrock AgentCore Runtime sessions) to 24 hours (Modal, E2B Pro, Vercel Sandbox on Pro, Render Workflows, and Upsun Cloud task containers) and 168 hours (Google Cloud Run jobs). Temporal and Trigger.dev set no run limit by default.

Can Upsun Cloud run a background agent that needs GPUs?

No. Upsun Cloud does not provide GPUs or host models. Agents on Upsun Cloud call external model APIs, and GPU-bound steps run on a separate GPU platform.

Is Upsun Dispatch the same as Upsun Cloud task containers?

No. Upsun Cloud task containers are a runtime for agents that teams build themselves. Upsun Dispatch is a separate product that runs governed coding-agent workflows on a team's repositories, and each product works without the other.

Stay updated

Subscribe to our monthly newsletter for the latest updates and news.

Deploy possibility.
Try Upsun for free.

Build with DispatchDeploy on Cloud