Devin on EC2 Mac: How Cognition Gives a Coding Agent a Mac

Devin on EC2 Mac: How Cognition Gives a Coding Agent a Mac

Cloud Platform Engineering

Nearly 1,000 organizations were running Devin on macOS within six weeks of its September 15 launch, Cognition says, yet Apple’s license lets each Mac host run only two extra copies of macOS at once. How Cognition squeezed a coding agent fleet out of that limit is a useful blueprint for any platform team that has to give agents, or iOS test pipelines, real Apple hardware.

How It Works

Before this, Devin Cloud ran only on Linux and Windows VMs. It could write Swift but not build or run the app, so it relied on a customer’s CI or Mac fleet. AWS’s write-up of Cognition’s design explains the move to EC2 Mac, where each instance is a physical Mac mini or Mac Studio attached to the Nitro System and runs on its own Dedicated Host.

Two constraints shape everything. A Dedicated Host has a 24-hour minimum allocation, so Cognition separates the life of a session from the life of a host. And the macOS license allows two extra virtual copies per Mac, which macOS enforces, so each host runs two isolated Devin workspaces at a time. A VM manager uses Apple’s Virtualization framework to boot a fresh guest per session, in under a minute, across six AWS Regions.

The density comes from snapshots. Much Devin work is asynchronous, so idle sessions give up their VM. A separate storage process handles each guest’s disk I/O through a Network Block Device frontend, since the Virtualization framework doesn’t support the vhost-user path Cognition uses on Linux. Cognition reports that about 90 percent of sessions release their Mac VM when idle and resume from a snapshot in seconds, so one host serves multiple sessions a day.

Networking needed custom work. Apple’s NAT option also manages rules in pf, the macOS packet filter, and raced with Cognition’s own pf controls. Cognition instead used a file-handle attachment and wrote a user-space Ethernet gateway per VM that validates addressing and source IPs before pf rules and proxies apply the session’s access policy.

Guest images are prepared before first boot. Cognition mounts the image on the host, creates the user and pre-grants accessibility and screen-recording permissions so no dialog blocks the agent, then warms up Xcode and the iOS Simulator.

What This Means for You

The most transferable idea is how the agent drives apps. Screenshot-and-click computer use is slow and costly across the pause, quit and relaunch paths Devin tests. Native apps expose an accessibility tree that describes each control’s role, name and state, so Devin queries for a “Resume” button, presses it by reference and re-reads the tree. Cognition built this on the open source accessibility-cli project from Dioxus, now part of Cognition, and still uses screenshots to check how the app looks. That fits the case we made for runtime verification of coding agents.

For your own fleet, AWS’s planning notes from the EC2 Mac user guide are blunt. One Mac instance per host, release only after 24 hours, On-Demand pricing that a Savings Plan can lower, and limited Regions. Hosts can be shared across accounts. Cognition uses an Auto Scaling group to allocate and release hosts where it lacks preallocated capacity.

Customer results are the vendors’ own claims. Wispr’s lead iOS engineer says Devin’s macOS support cut code review time by 70 percent and nearly doubled velocity.

The So What

Platform teams giving agents or iOS test jobs macOS should plan capacity in host-days, not jobs. Budget for two VMs per host and 24-hour minimums, and make idle release and snapshot resume the default, because that’s what turns two-per-host into a fleet. Teams building their own agent harness should expose the accessibility tree to the agent before relying on screenshot loops.

Source: AWS Architecture Blog

Content created with AI assistance and reviewed for accuracy.

💬

Join the conversation

Stack Insiders is our free community for readers who want to go deeper — share resources, ask questions, and connect with others across every vertical we cover.

Join Stack Insiders →

Newsletter coming soon.

Curated digests across AI, biohacking, photography, travel, and more. Be the first to know when we launch.