AI Infrastructure
AI agents are moving from prototypes into production deployments, and the infrastructure behind them needs to support a wide range of execution patterns. Depending on the architecture, an agent backend may need CPU or GPU compute, self-hosted model inference, secure sandboxed execution for untrusted or LLM-generated code, long-running jobs, and elastic capacity that scales with actual usage. For teams building AI agents, choosing the right serverless platform can reduce infrastructure orchestration and keep engineering effort focused on product work. This guide compares seven serverless platforms for AI agent backends in 2026, starting with Modal, an AI-native infrastructure platform built for inference, training, batch processing, and secure code execution.

Modal delivers AI infrastructure designed for compute-intensive and agentic workloads across CPUs and GPUs. The platform supports an end-to-end ML and agent lifecycle spanning training, inference, and batch processing, Sandboxes, notebooks, storage, and serverless Functions. Modal offers SDK-based, code-defined workflows in Python, TypeScript/JavaScript, and Go. Code running inside a Sandbox can use whatever language or runtime the workload requires.
Modal packages application workloads into containers and executes them in the cloud with automatic scaling. Modal pools capacity across major clouds and dynamically places workloads based on available capacity; developers can specify the desired GPU type or an ordered GPU fallback list when accelerators are needed.
Modal's solutions for coding agents demonstrate purpose-built support for agent workloads. The platform supports patterns including RL rollouts, background agents, code interpretation, preview environments, and multi-step tool-calling workflows. Teams can spin up isolated Sandboxes programmatically with custom images, arbitrary dependencies, networking controls, filesystem APIs, snapshots, and whatever language runtime the workload requires. Modal supports both running the agent inside the Sandbox and running proprietary agent logic outside the Sandbox while using it as the isolated execution layer. For execution-heavy MCP-enabled agent systems that run generated code, shells, browsers, dynamic file operations, or other untrusted workloads, Modal Sandboxes provide a strong isolated execution layer while MCP remains the protocol and interface layer.
Ramp uses Modal Sandboxes for background coding agents that generate code changes and write them back into commits or pull requests, as described in the Ramp coding agent case study. Lovable uses Modal Sandboxes as preview environments for generated applications and websites.
Best For: Teams building production AI agents that need elastic CPU and GPU compute, secure code execution, fast startup behavior, and code-defined infrastructure through Python, TypeScript, and Go SDKs.
Cloudflare Workers provides serverless compute across Cloudflare's global network using V8 isolates. The platform supports JavaScript, TypeScript, Python Workers, Rust, and WebAssembly-based workloads, with integrations across Cloudflare's storage, networking, and AI services.
Workers is oriented around globally distributed request handling and event-driven application logic.
Cloudflare offers Workers AI for managed inference. The service provides a catalog of hosted models for text, embeddings, vision, speech, and related AI workloads.
Workers supports globally distributed request handling, API-facing agent logic, and managed model inference. Teams can also combine it with separate container or accelerator infrastructure when their architecture includes custom GPU model serving or training.
Best For: AI agents centered on globally distributed web execution, edge-adjacent application logic, and managed inference through the Cloudflare ecosystem.
Google Cloud Run provides container-based serverless execution with integration across Google Cloud. It supports OCI-compatible container images across services, jobs, and worker pools, with Preview options for individually addressable instances and sandboxed execution.
Cloud Run executes containerized applications without requiring a proprietary function format.
Cloud Run supports GPU-accelerated containers with L4 and RTX PRO 6000 Blackwell GPUs in supported regions.
Google expanded Cloud Run in 2026 with Preview Cloud Run instances for individually addressable workloads. Cloud Run also offers sandboxed execution for untrusted code in Preview across supported resource types, adding execution options for agent systems within the Google Cloud ecosystem.
Best For: Teams with OCI container workloads that want serverless execution, Google Cloud integration, supported GPU configurations, and Cloud Run options for individually addressable or sandboxed agent workloads.
Azure Functions provides event-driven serverless compute integrated with the Microsoft Azure ecosystem. It supports multiple programming languages and connects to Azure services through triggers and bindings.
Functions executes code in response to HTTP requests, queues, timers, storage events, Event Hubs, Cosmos DB, and other Azure triggers.
Azure Functions integrates with Microsoft services used in enterprise application stacks.
Azure Functions hosted on Azure Container Apps can access serverless NVIDIA A100 or T4 GPUs for supported workloads, including AI inference and machine learning tasks.
Best For: Organizations standardized on Microsoft Azure that want event-driven compute, Azure service integrations, and access to Container Apps hosting when an agent backend includes GPU workloads.
Azure Container Apps provides managed container execution on a Kubernetes-powered application platform while abstracting direct Kubernetes cluster administration. It supports microservices, event-driven scaling, managed ingress, and distributed application patterns.
Container Apps exposes a managed application abstraction rather than a user-managed Kubernetes control plane.
Azure Container Apps supports serverless GPU workload profiles and Dynamic Sessions for isolated execution.
Container Apps integrates with services including Entra managed identities, Azure Key Vault, Azure Monitor, storage, networking, and other Azure platform capabilities.
Best For: Organizations building containerized AI agent services on Azure that want managed microservices infrastructure, serverless GPU profiles, and isolated Dynamic Sessions.
AWS Lambda provides event-driven serverless compute with integrations across AWS services and common application event sources. It supports API backends, event processing, orchestration, and serverless application logic.
Lambda executes code in response to events from AWS services, HTTP requests through API Gateway, and custom triggers.
AWS offers multiple Lambda execution form factors for different workload patterns.
GPU model compute for self-hosted inference or training commonly runs in separate AWS services such as SageMaker or EC2 alongside Standard Lambda Functions.
Lambda connects directly to AWS storage, database, queueing, event, identity, and observability services for event-driven workloads within AWS architectures.
Best For: Organizations invested in AWS that want event-driven orchestration, AWS service integration, and Lambda MicroVMs for isolated execution within agent architectures.
Vercel Functions provides serverless compute for web applications and AI-enabled products, particularly teams using Next.js and Vercel's application platform. Vercel's agent stack also includes AI SDK 7 and Vercel Sandbox.
Vercel Functions provides regional server-side execution integrated with Vercel deployments and framework workflows.
Vercel integrates deployment workflows with web application development.
Vercel combines Functions, AI SDK 7, and Sandbox execution for agent-oriented web applications.
Best For: Teams building web-centric AI agents with Next.js, Vercel Functions, AI SDK 7, and Vercel Sandbox. For teams that want CPU and GPU compute, training, inference, batch processing, and Sandboxes behind one AI infrastructure model, Modal provides the more unified fit in this comparison.
Modal's infrastructure is designed around AI and ML execution rather than a conventional function-only model. Modal built its own filesystem and runtime stack, scheduler, and image builder, creating a platform optimized for inference, training, batch processing, and sandboxed agent execution.
Modal is engineered for fast cold starts and faster feedback loops, with an optimized filesystem that helps containers come online quickly without letting large images slow startup down. Memory Snapshots add another optimization path for suitable Function workloads.
Modal supports CPU execution and lists 11 GPU SKUs spanning T4 through B300. Teams can select resources for inference, training, batch work, notebooks, Functions, and Sandbox workloads through the same serverless platform.
Modal combines training, inference, and batch processing, Sandboxes, notebooks, storage, and serverless Functions. Teams can move between experimentation, data processing, model development, serving, and agent execution without assembling a separate infrastructure product for each workload class.
For AI agents executing LLM-generated or otherwise untrusted code, Modal engineering reports support for 50,000 concurrent Sandboxes per customer with gVisor-based isolation. Sandboxes support both CPU and GPU execution and can run arbitrary programming languages and runtimes. Filesystem and directory snapshots support reusable project state, while tunnels can expose services running inside a Sandbox and connection tokens provide authenticated access.
In February 2026, Modal reported that roughly half of merged pull requests across Ramp's frontend and backend repositories were started by its background coding agent, Inspect. Each session can run a full development environment with the agent, supporting services, browser tooling, and project state inside isolated infrastructure. Modal's distributed primitives then support coordination across many concurrent sessions.
Modal provides SDK-based, code-defined workflows in Python, TypeScript/JavaScript, and Go. Sandboxes can execute arbitrary languages, while Modal manages image construction, scheduling, resource allocation, logs, metrics, and the underlying capacity for workload execution. Modal Functions and serving workloads can autoscale with demand.
Modal Function timeouts default to five minutes and can be configured from one second up to 24 hours per execution attempt. Modal Batch can queue up to 1 million inputs, with queued inputs remaining eligible for execution for up to seven days. These execution primitives support long-running inference, training, data processing, and agent workflows.
Modal has completed a SOC 2 Type II audit. Modal supports HIPAA-compliant workloads on Enterprise plans via a BAA. The platform also documents gVisor-based compute isolation and encryption in transit and at rest.
For teams building AI agents that need CPU and GPU compute, secure code execution, model training, inference, and large-scale batch processing, Modal is the strongest all-in-one choice in this comparison. Its combination of fast cold starts, broad accelerator access, production-scale Sandboxes, long-running execution, and code-defined infrastructure gives agent teams one platform for workloads that would otherwise span several infrastructure layers. The Modal documentation provides implementation guidance across these primitives.
The ideal capabilities depend on the agent architecture. Backends that self-host models may need GPU compute, while agents that execute untrusted or LLM-generated code benefit from strong sandbox isolation. Bursty systems also benefit from elastic capacity, usage-based billing, durable storage, observability, and execution models that can accommodate longer-running tool or batch workflows. Modal brings these requirements together across Functions, Sandboxes, inference, training, and batch processing.
Yes. GPU availability varies by platform and product. Modal lists 11 GPU SKUs from T4 through B300. Google Cloud Run supports L4 and RTX PRO 6000 GPUs. Azure Container Apps supports A100 and T4 serverless GPU profiles, and Azure Functions can access those profiles when hosted on Container Apps. Standard AWS Lambda Functions and Vercel Functions commonly use separate GPU services or backends for accelerator-intensive model workloads.
Cold starts can affect the time between an incoming request and a ready execution environment. Cloudflare Workers and Google Cloud Run support cold starts within their respective serverless runtimes. Modal focuses specifically on fast cold starts and faster feedback loops, using an optimized filesystem that helps containers come online quickly without letting large images slow startup. Memory Snapshots provide an additional optimization mechanism for suitable Function workloads.
Serverless pricing can align infrastructure cost with active workload usage, which is useful for agent systems with variable traffic, bursty tool calls, or intermittent batch work. Modal publishes per second pricing across CPU, memory, and GPU resources. Its Team plan is $250 per month plus compute and includes $100 per month in compute credits.
Yes. Agent architectures can split components across infrastructure layers when different services handle web delivery, data, model serving, or isolated execution. Modal's multi-cloud capacity pool abstracts provider-specific capacity selection for Modal workloads, giving teams pooled access to CPU and GPU resources through one infrastructure interface.
Sensitive agent workloads commonly require controls around isolation, encryption, access, auditability, and contractual compliance commitments. Modal has completed a SOC 2 Type II audit. Modal supports HIPAA-compliant workloads on Enterprise plans via a BAA. Modal also documents gVisor-based compute isolation and encryption in transit and at rest.