Choosing a Deployment Target for an Agent Workload
Where an agent runs shapes timeouts, cold starts, secret delivery, concurrency, and how you recover from crashes.
Search across all documentation pages
Where an agent runs shapes timeouts, cold starts, secret delivery, concurrency, and how you recover from crashes.
Pick the target from workload shape first, not from habit or marketing labels.
An agent workload is more than "call the model once."
Typical steps: accept a request or event, load context, call one or more models, invoke tools, loop, write state, and return or notify.
That loop has properties that matter for hosting:
| Property | Why it affects hosting |
|---|---|
| Duration | Platform max execution time |
| Burstiness | Scale-to-zero vs always-on cost |
| State | In-memory session vs external store |
| Tools | Local binaries, browsers, network egress |
| Concurrency | Rate limits and memory per replica |
| Restart behavior | Crash recovery and in-flight work |
Three common placement classes:
Managed "agent platforms" still sit on one of these underneath. Evaluate them with the same table.
| Workload shape | Prefer | Avoid as primary |
|---|---|---|
| Short chat turn, under platform timeout, little local state | Serverless or scale-to-zero containers | Oversized dedicated VPS |
| Multi-minute research / multi-tool loop | Containers or VPS workers + queue | Pure request-scoped serverless without async handoff |
| Always listening (Slack, Telegram, websocket bots) | VPS or long-lived container | Cold function that only wakes on HTTP if the platform needs a durable socket |
| Heavy tools (Playwright, local code exec) | Container or VPS with sandboxing | Tiny function packages and tight /tmp |
| Spiky public traffic, idle nights | Serverless or Cloud Run-style scale-to-zero | Large always-on fleet |
| Strict private networking / custom NIC rules | VPC-attached containers or VPS | Public-only function with no private path |
A production pattern:
Client → API (serverless or edge)
→ enqueue job id
Worker (container / VPS) → agent loop → tools → model API
→ write result / webhook
Client polls or receives pushThe API stays under timeout limits. The worker owns the long loop.
| Factor | Serverless | Containers (managed) | VPS |
|---|---|---|---|
| Idle cost | Near zero | Low if scale-to-zero; else baseline | Always on |
| Busy cost | Per-ms + invocations | Per replica-hour | Fixed box + oversize risk |
| Ops load | Low | Medium (images, health) | Higher (OS, TLS, restarts) |
| Failure modes | Timeout, cold start, package limits | OOM, deploy lag, cluster config | Disk full, unattended process death |
Exact prices change constantly - model your cost per successful task, not only host list price.
If your platform caps at N seconds, your agent product must either finish earlier, stream partial progress, or offload work.
Do not "hope" a multi-hop RAG + tools path stays under the cap.
See Cold Starts and Long-Running Agent Loops: A Serverless Mismatch.
Code execution, browser automation, and untrusted file handling want isolation (Containerized Sandboxes for Code-Executing Agent Tools).
That isolation is natural with Docker images and hard on many pure function runtimes.
| Approach | Strength | Weakness | Best when |
|---|---|---|---|
| Serverless function as agent | Fast ship, scale-to-zero | Timeouts, cold starts, package limits | Short turns, light tools |
| Managed container | Portable image, flexible runtime | More moving parts than a function | Medium/long jobs, custom deps |
| VPS process | Full control, long lived | You own restarts and security | Always-on bots, early ops simplicity |
| Queue + worker | Decouples intake from work | Needs job semantics and idempotency | Anything longer than API SLOs |
Yes if a realistic path fits under the platform timeout with margin and tools are remote APIs only. Otherwise start with a container worker.
Low concurrency, one team owning the box, and a process manager with restart policy. Plan an exit path before traffic multiplies.
Containers define the image. On a VPS you still want systemd or similar so reboots and crashes recover the process. Orchestrators replace that with their own restart policy.
Cold starts add hundreds of ms to many seconds before your code runs. Warm capacity, provisioned concurrency, or always-on workers buy latency at cost.
Framework choice rarely forces the host. Duration, state store, and OS dependencies do. Verify framework server modes against your platform at build.
Treat GPU as a specialized container or VM pool, not a generic function. Queue jobs onto GPU workers.
Placement decides what you deploy (zip, image, or binary) and how you roll back. Pair with CI/CD and Agent Lifecycle Basics.
It is a scale-to-zero container platform: Docker image semantics with request-driven scaling. Map it with container packaging rules and serverless-ish timeout habits.
Streaming needs a connection long enough for the response. Short function timeouts break streams; use longer-lived handlers or separate stream gateways.
Timeout rate, cold-start P95, cost per successful task, deploy frequency pain, and tool dependency friction.
Often yes for app code. Keep env-specific config out of the image and inject at runtime (Containerizing an Agent with Docker).
Usually a small VPS or home lab with a process manager, not a commercial function with aggressive idle freezes - see self-hosted personal agent sections if you run that pattern.
Related: Deploying Agents Basics
Related: Containerizing an Agent with Docker
Related: Deploying an Agent to Vercel or AWS Lambda Serverless Functions
Related: Long-Running Agents on a VPS: Process Management and Restarts
Related: Cold Starts and Long-Running Agent Loops: A Serverless Mismatch
Related: Deploying Agents Best Practices
Stack versions: Pins from the category manifest (verify at build): OpenRouter (~315+ models, July 2026 pricing/fees); LangGraph 1.0+; CrewAI 1.14+; Microsoft Agent Framework 1.0; Vercel AI SDK 6; Pydantic AI (latest); LlamaIndex (latest); OpenAI Agents SDK (latest + MCP); MCP (Linux Foundation governance); A2A (HTTP+SSE+JSON-RPC 2.0); Solana
@solana/web3.js+@solana/spl-token.
Reviewed by Chris St. John·Last updated Jul 16, 2026