AI agent infrastructure: the 6 layers and what to use (2026)
AI agent infrastructure is everything around the model that lets an agent act: the place its code runs, the place its state lives, the way it reaches tools, and the way it is deployed and watched. It splits into six layers: model access, orchestration, code execution, state and memory, browsers and computer use, and hosting with scheduling and observability. Most teams buy the model, take the framework from open source, and rent the rest by the second or by the month.
Lizard covers three of the six layers: Lizard Sandboxes for code execution, Managed Postgres, Managed Redis and Managed Object Storage for state, and apps and schedules for hosting. One command starts a microVM with Claude Code installed: lizard sandbox create -t claude -s small. A Small sandbox has 2 vCPU, 4 GB of RAM and a 20 GB disk and costs $0.0162 an hour, billed per second (pricing). Lizard sells these three layers and none of the others, so weigh its place in the tables with that in mind.
Every price in this guide is in US dollars, comes from the vendor's own pricing page and was checked on 15 November 2026.
What is AI agent infrastructure?
AI agent infrastructure is the set of services an agent needs besides the model itself. A model only returns text. To do work, an agent needs a loop that calls the model repeatedly, a machine for its commands, storage that outlives one conversation, access to websites and APIs, and a host that keeps it online.
The term has a second meaning. A January 2025 paper, Infrastructure for AI Agents, uses it for protocols and systems outside the agent that shape how agents interact, such as attributing an agent's actions to a person. This guide covers the first meaning: the stack a team assembles to ship an agent product.
What are the six layers of AI agent infrastructure?
The six layers are model access, orchestration, code execution, state and memory, browsers and computer use, and hosting with scheduling and observability. Each one is billed in a different unit.
| Layer | What it does | Options | Cost unit |
|---|---|---|---|
| 1. Models and gateways | Runs the model, routes between providers | Claude API, OpenAI API, Gemini API, OpenRouter, Cloudflare AI Gateway, LiteLLM | Per million tokens; gateways add a fee on credits |
| 2. Orchestration | Runs the agent loop, retries, handoffs | LangGraph, OpenAI Agents SDK, Claude Agent SDK, Pydantic AI, Google ADK, Temporal, Inngest | Open source: $0. Hosted engines: per action or execution |
| 3. Code execution | Runs the commands and code the agent writes | Lizard Sandboxes, E2B, Daytona, Modal | Per second of vCPU and memory |
| 4. State, memory and files | Keeps sessions, facts, queues and artifacts | Postgres, Redis, S3-compatible storage, Mem0 | Per GB-month, plus database CPU and memory |
| 5. Browsers and computer use | Lets the agent click through websites and desktops | Browserbase, Steel, Playwright MCP, Browser Use, desktop sandboxes | Per browser hour |
| 6. Hosting, scheduling, observability | Keeps the agent online, wakes it up, records traces | An app platform, a schedule, Langfuse, LangSmith | Per vCPU and GB-month; per trace or unit |
A small agent can skip layers 4 and 5. An agent that writes code cannot skip layer 3.
Which model API or gateway should an agent use?
Use the model provider's API directly until you need a second provider, then add a gateway. Direct access has no extra fee.
Model prices are per million tokens (MTok). Anthropic lists Claude Sonnet 5.5 at $2 input and $10 output per MTok, and Claude Haiku 5.5 at $0.10 and $0.50 for prompts up to 100,000 tokens (Anthropic pricing). OpenAI lists gpt-6.1-sol at $2 input and $10 output per MTok at the standard tier (OpenAI pricing).
A gateway gives you one API for many models and a fallback when a provider fails. OpenRouter bills inference at the provider's list price and charges 5.5% when you buy credits on its Standard plan (OpenRouter pricing). Cloudflare AI Gateway applies a 5% fee to credits bought through its Unified Billing and passes provider prices through with no markup (Cloudflare AI Gateway pricing). LiteLLM is a proxy you host yourself, so you pay for the machine it runs on.
Tokens can easily be the largest line in an agent's bill. In the test below, one agent turn cost about 1,400 times more in tokens than in machine time.
Which orchestration framework does an agent need?
An agent needs a loop that sends the conversation to the model, runs the tool calls that come back and repeats until the task is done. Open-source frameworks provide that loop for $0.
On 15 November 2026 these agent frameworks carried an open-source license on GitHub: LangGraph (MIT), the OpenAI Agents SDK (MIT), the Claude Agent SDK (MIT), Pydantic AI (MIT) and Google ADK (Apache 2.0). Pick the one that matches your language and model provider. A coding task may need no framework: Claude Code and Codex are complete agents that take a prompt and work until they finish.
Long tasks need durable execution: a run survives a crash or a deploy and continues from the last finished step. Temporal Cloud starts at $50 per million actions with no base monthly fee (Temporal pricing). Inngest includes 50,000 executions a month at $0, and its Pro plan costs $99 a month with 1 million executions, then $50 per million (Inngest pricing).
Where should an AI agent run code?
An AI agent should run code in a sandbox: a disposable machine that holds none of your secrets and can be deleted after the task. Code written by a model is untrusted, and a prompt injected through a web page can turn it against the host.
The four providers below bill per second. The table prices the same shape, 2 vCPU and 4 GB of RAM, for one hour of running time, without plan fees.
| Provider | 2 vCPU, 4 GB, one hour | Plan fee | Source |
|---|---|---|---|
| Lizard Sandboxes (Small) | $0.0162 | Pro $19 a month, $19 of usage included | lizard.build/pricing |
| E2B | $0.1656 ($0.000028/s plus $0.000018/s) | Hobby $0, one-time $100 credit; Pro $150 a month plus usage | e2b.dev/pricing |
| Daytona | $0.1656 ($0.0504 per vCPU-hour plus $0.0162 per GiB-hour) | None listed; $200 of compute included | daytona.io/pricing |
| Modal Sandboxes | $0.238 ($0.00003942/s per core of 2 vCPU, $0.00000667/s per GiB) | Starter $0 with $30 of credits a month | modal.com/pricing |
The hourly rate does not settle the choice. E2B's Hobby plan limits a session to 1 hour and its Pro plan to 24 hours. Modal charges for the higher of what a container requests and what it uses, so a sandbox that requests less can cost less than the table shows. Compare plan fees, session limits and how many sandboxes run at once.
Lizard Sandboxes are Firecracker microVMs, each with its own kernel. A create with no size is Medium ($0.0324 an hour), so pass -s small for the Small price, and a new sandbox lives 5 minutes unless --timeout says otherwise. On the 7-day trial an account runs 1 Small and 2 Mini sandboxes at a time, in US regions, and each is deleted at most 1 hour after it starts (limits). Longer runs and parallel forks need a paid plan. Pro runs up to 40 vCPU at once, which is 20 Small sandboxes.
For more detail on three of these providers, read E2B vs Daytona vs Modal.
Where should an agent keep state, memory and files?
Keep durable state in Postgres, short-lived memory and queues in Redis, and files in S3-compatible storage. A sandbox disk is working space and is deleted with the sandbox.
Postgres holds what must not be lost: users, sessions, task records and long-term facts. An agent can query it through a Postgres MCP server. Redis holds what is read often and can be rebuilt, such as recent messages, rate limits and job queues. Our guide to AI agent memory with Redis shows how. Object storage holds what the agent produces, such as reports and screenshots. For memory as a library, Mem0 is open source under Apache 2.0.
On Lizard, Managed Postgres and Managed Redis are billed per second at $18.26 per active vCPU-month and $9.13 per active GB-month of memory, plus $0.14 per used GB-month of disk. Managed Object Storage costs $0.0135 per stored GB-month (pricing). Managed Redis saves snapshots to disk and loads the last one when it starts, so writes made after the last snapshot are lost if it stops suddenly. Put data you cannot lose in Postgres.
How does an agent use a browser or a desktop?
An agent uses a browser through a browser automation tool, and a desktop through a computer use tool that sends screenshots to the model and gets clicks and keystrokes back. A browser fits tasks on websites; a desktop fits applications with no API. Our computer use agents guide has a tested run on a cloud desktop.
Hosted browsers are billed per browser hour. Browserbase's Developer plan costs $20 a month with 100 browser hours included, then $0.12 per browser hour (Browserbase pricing). Steel's Launch plan costs $0 a month plus usage at $0.10 per browser hour, with $30 of one-time credits and sessions up to 15 minutes (Steel pricing).
The open-source route is to run the browser yourself inside a sandbox. Playwright MCP (Apache 2.0) gives any MCP-capable agent a browser, and Browser Use (MIT) is a Python library for the same job. You then pay for the sandbox's seconds and nothing per browser hour. For full desktops, Lizard CLI 4.0.128 lists a desktop template; I did not run it for this guide.
How do you host, schedule and observe agents?
Host the part of the agent that must always answer as a normal web service, wake the rest on a schedule, and send every run to a tracing tool.
The always-on part is usually small: an API that accepts tasks and a worker that starts sandboxes. On Lizard an app costs $18.26 per active vCPU-month and $9.13 per active GB-month, the same rates as the databases (pricing).
A scheduled agent needs no server that waits. lizard sandbox schedule <id> --every 1h --command "python3 /workspace/job.py" wakes a paused sandbox, runs the command and puts the sandbox back to sleep. With --prompt it runs a coding agent instead. A pause keeps files only: processes and memory end, and the next run boots fresh. A paused sandbox has no compute charge and costs $0.14 per GB-month of used disk (pricing).
Observability for agents means traces: every model call, tool call, token count and cost for one run, in order. Langfuse includes 50,000 units a month on its Hobby plan, and its Core plan costs $29 a month with 100,000 units, then $8 per 100,000 (Langfuse pricing). LangSmith's Developer plan costs $0 for one seat with 5,000 base traces a month, and Plus costs $39 per seat a month (LangSmith pricing).
What does one agent turn cost in a sandbox?
In my test on 15 November 2026, one short agent turn cost $0.0219 in model usage and about $0.000015 in sandbox time. The tokens cost about 1,400 times more than the machine the agent ran on.
I ran these commands with Lizard CLI 4.0.128 on a paid account in us-east-1. The prompt step went through the same platform API the command calls, as explained below:
lizard sandbox create -t claude -s small --timeout 600000 --json
lizard sandbox exec <id> -- bash -lc 'nproc; claude --version'
lizard sandbox prompt <id> --agent claude "Create /workspace/fib.py that prints the 30th Fibonacci number, run it with python3, and reply with only the number it printed."
lizard sandbox fork <id> -n 2
lizard sandbox rm <id>The create returned a running Firecracker sandbox with 2 vCPU and 4,096 MB at pricePerHour: 0.0162, and the exec printed 2 and 2.1.286 (Claude Code). The agent wrote the file, ran it and answered 832040 in 3.4 seconds with two tool calls. The platform reported $0.0218712 of model usage for the turn. At $0.0162 an hour, 3.4 seconds of a Small sandbox costs $0.000015. A full hour of that sandbox costs less than the tokens of this one turn.
The fork started two live copies of the running sandbox. I ran python3 /workspace/fib.py in one copy and it printed 832040 again, then I deleted all three sandboxes.
The agent step ran through the platform API, which is the call lizard sandbox prompt makes, and I checked the CLI flags with --help. I also created the schedule from the previous section with --disabled and did not wait for it to fire. Agent credentials belong to a project, so connect your Claude token in the project the sandbox runs in.
What do three reference stacks look like?
A prototype needs the first three layers, a production product needs all six, and an evaluation or reinforcement learning (RL) run needs layer 3 in bulk. RL environments for LLM agents covers those runs. The sandbox arithmetic below uses Lizard's Small rate of $0.0162 an hour and leaves out model tokens.
Prototype
Use one model API key, a coding agent or a small framework loop, and one sandbox. Keep files on the sandbox disk and skip the database. Lizard Pro costs $19 a month and includes $19 of usage. One Small sandbox running all month (730 hours × $0.0162) costs $11.83, which fits inside that amount if nothing else uses it. The 7-day trial is enough for a first test, with its limit of 1 hour per sandbox.
Production SaaS
Put a gateway in front of two model providers and add a framework with durable execution, one sandbox per user session, Postgres for sessions and facts, Redis for queues, object storage for artifacts, and traces for every run. Sandbox time is a small line: 1,000 sessions of 10 minutes each are 166.7 Small-hours, or $2.70. Check concurrency: Pro runs 20 Small sandboxes at once and Pro 5x ($99 a month) runs 110.
Evaluation or RL fan-out
Prepare one sandbox with the repository, dependencies and warm processes, then fork it. lizard sandbox fork <id> -n 100 starts up to 100 copies in one command. One hundred Small copies use 200 vCPU, which needs Pro 5x and its 220 vCPU. If each copy runs 5 minutes, the batch uses 8.3 Small-hours and costs about $0.14. On the trial, forking a Small is refused while that Small runs, so fan-out needs a paid plan.
FAQ
What is AI agent infrastructure? AI agent infrastructure is the set of services around a model that let an agent do work: model access, orchestration, code execution, state and memory, browsers and computer use, and hosting with scheduling and observability.
Do AI agents need a sandbox? An agent that runs shell commands or generated code needs one, because the sandbox keeps untrusted code away from your servers and secrets. An agent that only calls a few fixed APIs can run without it.
How much does AI agent infrastructure cost? Model tokens are often the biggest cost. In a test on 15 November 2026, one agent turn used $0.0219 of model usage and $0.000015 of time on a Lizard Small sandbox at $0.0162 an hour.
Where should long-running agents be hosted? Run the always-on API as a web service and the agent's work in sandboxes with a long timeout. On Lizard a paid sandbox runs up to 596 hours; a trial sandbox is deleted after 1 hour at most.
Build with AI. Ship with Lizard
You don't need a platform team to go live. Your whole cloud, one CLI command away.
- Services
- —
- Add-ons
- —
- Deployments
- —
- Sandbox starts
- —