When AWS released Lambda MicroVMs, we were among the first teams to try it out for Aim, our AI marketing agent. Our existing setup at the time couldn't support Aim's growing usage the way we wanted, so we were already exploring alternatives. Lambda MicroVMs offered a few features that we needed, and since a lot of Profound's stack was already on AWS, we decided to give it a shot.

Here are some reflections on how we set it up, what worked, what didn't, and what we're planning to do next.

Why the change?

Aim began as a root cause analysis bot that answered customers' questions about which Profound metrics changed and why. But soon it grew into a general-purpose agent that runs across the entire platform, powers features like Profound Agents and Projects, scans customers' workspaces to proactively suggest improvements, and so on.

The first version of Aim ran on a different hosted sandbox provider, which worked well until the growing usage made small problems pile up. For example, the provider ran its sandboxes on their own infrastructure outside our AWS network, so when Aim had to call Profound's internal services, the calls had to leave our AWS network and go across the public web. Every call cost an extra hop or two, and every one of those internal services had to be reachable from outside of our network to be able to communicate with Aim. That had a direct effect on latency, including time to first token (TTFT) in Aim chats, let alone the security posture.

The way Aim's usage spread across our systems also meant that it needed strong untrusted code isolation. The industry standard sandbox provider for running untrusted code is Firecracker, which runs the untrusted code in a separate sandbox with its own kernel. Our provider ran its sandboxes on gVisor instead, which isolates untrusted code by intercepting its syscalls in software. This wasn't enough for what Aim was becoming, and while we were with that provider, using Firecracker was off the table.

Our provider was also having stability issues, and we wanted to protect our customers from that at all costs.

At that point we were leaning towards self-hosting E2B inside our own AWS account. That would have fixed the networking problem and given us Firecracker, but would come with the cost of running the whole sandbox fleet ourselves. We were still ready to accept it, but as we were about to prepare for the switch, AWS announced their Lambda MicroVMs. Within hours of the announcement we had a proof of concept, and in a couple of weeks we did the cutover in production.

The anatomy of an Aim session

The issues we had with our first setup informed the new architecture of the Aim session.

A diagram of the architecture of Aim session, including chat, the gateway, the persistence layer, the runtime worker and untrusted sandbox and the LLMs.

One session, two sandboxes

Each session runs in two sandboxes, each with a different job. One houses the runtime worker, which runs the agent loop, calls the model, and coordinates tool calls. The second one runs untrusted code and tools that need to touch the filesystem.

We also hardened the untrusted sandbox's network and file system access, inspired by Anthropic's open-source sandbox-runtime. The code there runs with no privileges, can't read most of the filesystem, and has no route into our private network at all.

This solved our isolation issue (and gave us Firecracker).

The Gateway

When a chat or any other surface calls Aim, the requests go to the Gateway - a custom-built proxy that sits between the sandboxes and our internal services. It keeps the requests inside our AWS network, handles credentials and persistence. If a tool inside a sandbox needs an API key, the Gateway makes that call on the sandbox's behalf. If a session needs to save an artifact, the Gateway writes it to our blob storage.

Hiding the cold start (with the warm pool)

With our current setup, a fresh sandbox takes two to three seconds to start at p95 (which comes from the number of dependencies packaged into it). That's time spent before the agent even starts working, so the user has to wait that long whenever the chat starts or resumes.

To counteract this cold start, we keep a warm pool of ready-to-go sandboxes, launched ahead of demand. When a user opens a chat and starts typing, the Gateway claims a pair of sandboxes from the pool and attaches them to their session. This brings down the cold start time to under 100 ms at p99, which removes nearly all of the startup wait for the user.

Session state continuity

While a sandbox is running, the intermediate state of the Aim session, such as working files and scripts, is stored on the sandbox's local disk. When the sandbox stops, the state of the session (the conversation turns, artifacts, and checkpoints) goes through the Gateway to our persistence layer: the database and the blob storage. Whenever a user comes back to the session, a fresh sandbox can pick it up from there.

The outtakes

At the time of writing this article, several hundred thousand sandboxes launch for Aim every month. One scheduled pipeline that analyzes every customer category to surface suggestions, launches thousands of sandboxes across thousands of categories every other day.

The Lambda MicroVM setup handles this load today, and the move solved most of the issues we had on our previous setup. But the design is not perfect and there are still a few issues we keep working on.

What improved

A big improvement after the cutover in early August 2026 was that Aim's TTFT went down by over 20%: from 10-12 seconds for a new chat and 8-9 seconds per turn after that, to 8-9 seconds and 6-7 seconds respectively. However, this rests largely on the removal of the extra network hops, and the numbers may look a bit too flattering. Aim used to be a much simpler product, and since then it has more artifacts to work with and loads more of the user's past context for a personalized chat experience. This adds latency, and we keep tracking and optimizing it as we build more around Aim.

Another improvement was that owning the stack changed how we deal with reliability. All of Aim's uptime and downtime is now something we own, which is a big win for stability.

What's still in the works

The new setup comes with some trade-offs and open questions that shape how we think about the future of the sessions' architecture in the context of how Aim usage expands and transforms.

As we grow our customer base, customers depend on Aim for more of their work, and the sessions keep getting longer: instead of one-off chats that finish one task, they become ongoing collaborations that perform many tasks and pause for a human review. Long-running work like this makes the intermediate state matter as much as the final outcome, so we have to think about moving it from sandbox local disks to our own storage.

The way persistence works today is not ideal for handling the scale: every Aim session writes its conversation state through the Gateway into the same database, which puts more and more load on both of them as the usage grows. A solution we're exploring is giving each session ownership of its own state: blob storage as the session's file system, with a lightweight local database inside it for conversation state.

We also want to own more of the session lifecycle. With AWS, our sandbox launch rate is limited by account quotas. A batch job like the background per-category analysis needs thousands of sandboxes, which is why we had to ask AWS to raise our quotas more than once. At the rate Aim usage grows today, depending on external quotas seems unsustainable, so now we're back to considering managing the sandbox lifecycle ourselves on plain compute.

If these are the kind of problems you like working on day-to-day, our team is hiring.