By Mahan Kenway
Cover: Original conceptual illustration created for this article; it does not depict a real AWS interface.
An AI coding agent can produce a patch in seconds. Running that patch is a different problem: the code might install unexpected dependencies, reach the network or interfere with another job. Even a benign test can fail halfway through, leaving a pipeline to decide what to retry and what to clean up.
On November 25, AWS announced a developer preview that connects two existing Lambda capabilities: durable functions for orchestrating multi-step work and MicroVMs for isolated execution. The new SDK extension can launch a MicroVM, send it a job, wait for the result and manage its lifecycle as part of a durable workflow.
The useful idea is not that AI-generated code becomes trustworthy. It is that a team can give the code a separate execution environment while treating the surrounding build, test and review sequence as an explicit workflow. There are important limits, though: this extension is a developer preview, not for production workloads, and a durable execution lasting up to a year does not mean a single MicroVM can run that long.
Two different problems: isolation and orchestration
Lambda MicroVMs are serverless environments built on Firecracker virtualization. AWS describes them as suitable for user- or AI-generated code, with a dedicated environment per job or user. A team supplies an image, starts a MicroVM and can configure its networking and lifecycle. Memory and disk state can be preserved when a MicroVM is suspended and resumed.
Durable functions address a different concern: keeping track of a workflow across waits, callbacks and failures. AWS says a durable execution can span up to one year, with checkpoints and retries. The new extension joins these layers so the workflow can coordinate the isolated compute instead of a developer having to assemble every lifecycle operation separately.
Imagine a pull request that triggers three independent test jobs. A durable function could fan them out to separate MicroVMs, collect results and send the outcome to a human reviewer. That is an illustrative design, not an assertion that the preview supplies a complete secure CI system out of the box.
One job or a shared session
The TypeScript extension's README documents two patterns:
microvm launches a MicroVM, runs one job, waits for the result and terminates it.
microvmSession starts one MicroVM and lets several jobs run in the same session. Those jobs share files and processes, which is convenient for a build followed by tests but means they are not isolated from one another.
For separate pull requests or mutually untrusted tenants, reusing a shared session can undermine the separation you intended. A fresh MicroVM per trust boundary is a safer starting point than assuming separate job calls mean separate machines. The SDK also shows a map pattern for running jobs in parallel with separate MicroVMs.
An optional worker library in the MicroVM image receives jobs, reports results and sends heartbeats. The announcement covers extensions for the Python and TypeScript durable execution SDKs; the specific API details below come from the TypeScript README and should be checked against the language and version you actually deploy.
One year is not eight hours
The two clocks are easy to confuse. AWS says a durable workflow may last up to one year, while a Lambda MicroVM's total lifespan is up to eight hours, including running and suspended time. A long approval or a multi-day process therefore cannot depend on one MicroVM staying alive throughout.
If a workflow needs to pause beyond a VM's lifetime, persist the artifacts it needs outside that VM and start a fresh environment when work resumes. Treat snapshots as a convenience for preserving session state within the documented lifecycle, not as an indefinite backup or a replacement for artifact storage.
There are subtler session details. The TypeScript SDK documentation says automatic resume requires idlePolicy.autoResumeEnabled; the SDK does not set it for you. It also warns that a low idle threshold can suspend a running job because the idle timer counts inbound requests, and that suspending a VM while another job in the same session is running freezes that job too. Set heartbeat and timeout values deliberately, and test suspend/resume behavior before relying on it.
A few details that will save debugging time
The preview's SDK documentation contains several practical gotchas:
- Use an appropriate function timeout. Every session job uses HTTP, and its request step needs at least 11 seconds remaining in the invocation. The README says Lambda's three-second default fails every session job; 71 seconds gives the request step its full 60-second retry window.
- Set a heartbeat timeout. Otherwise, a job whose MicroVM has ended may wait until its full job timeout before the failure is recognized.
- Check both execution roles. The durable function needs permissions to launch and terminate MicroVMs and, depending on the operation, use network connectors and pass the VM role. The VM role needs permission to report durable callbacks. AWS warns that without
lambda:TerminateMicrovm, a VM can continue running and being billed until its maximum duration.
- Keep results small. The TypeScript README limits a job's JSON result to 256 KB and its JSON input to 6,283,264 bytes. Pass larger artifacts by reference, with access scoped to the specific job.
- Pin the workflow version. AWS recommends invoking a published version or alias rather than
$LATEST, so replays use the same code.
These are not merely setup annoyances. A missing termination permission can turn a failed cleanup into avoidable compute charges, while a missed heartbeat can make a dead job look like a slow one.
Retries do not make side effects exactly once
Checkpointing makes recovery easier, but it does not make every operation safe to repeat. AWS says completed steps return their checkpointed result during replay, yet steps have at-least-once execution semantics by default. If a step performs a database write or publishes an artifact and fails before completion is recorded, it may run again.
Use stable job identifiers, deduplicate external writes and make cleanup repeatable. Also distinguish a retry of an individual step from a retry of the whole execution: the behavior depends on how the workflow was invoked. AWS's retry documentation notes, for example, that an asynchronous durable execution that has entered a failed state is not automatically retried in the same way as a conventional asynchronous Lambda function.
For pull-request testing, a useful exercise is to deliberately interrupt a job after it uploads an artifact but before the workflow records success. Verify that recovery does not create a second release, duplicate a notification or promote a stale result.
The sandbox is a boundary, not a permission policy
A VM boundary helps separate workloads from the host and each other. It does not make code harmless inside its own environment, and it does not automatically prevent access to data, credentials or network destinations you deliberately give it. The MicroVM guide describes configurable inbound and outbound networking, including internet and VPC access.
Give the VM only the minimum role permissions needed, avoid placing long-lived secrets in images, restrict egress and reachable internal services, and keep build inputs and outputs scoped to the job. Review dependency installation and artifact promotion separately. Logs, cleanup failures and unexpected network activity deserve monitoring; none of those controls follows automatically from the word “isolated.”
Costs need attention too. AWS describes MicroVM billing in terms of compute while running and snapshot storage while suspended; durable operations and other services can add their own charges. Measure a realistic workflow rather than assuming a suspended VM or a retrying pipeline is free.
Where to start
For an evaluation, use a disposable AWS environment and a non-sensitive sample repository. Start with one short job, add the worker to a MicroVM image, and follow the official SDK example for role permissions, timeout, heartbeat and cleanup. Then test a failing job, a retry and, if needed, a multi-job session. The feature is available in AWS Regions that support both durable functions and MicroVMs; check current service availability before planning a rollout.
The preview is a useful building block for teams experimenting with AI-assisted development. Its real test is not whether it can run a generated patch, but whether a team can prove what the patch accessed, recover safely when work fails and dispose of the environment afterward.