Noureddine RAMDI / Running autonomous software engineering agents with AWS CDK and EC2 workers

Created Mon, 04 May 2026 10:23:01 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

aws-samples/remote-swe-agents

Autonomous software engineering (SWE) agents are gaining traction for automating coding tasks like PR creation and code reviews. But running these agents efficiently at scale without blocking developer machines or incurring high costs is a real challenge. The aws-samples/remote-swe-agents repository tackles this by spinning up isolated EC2 worker instances for each agent session, orchestrated through AWS CDK, and managed via a modern web interface.

architecture of remote SWE agents

Remote SWE Agents is an open-source implementation of autonomous software engineering agents modeled after systems like Devin, OpenAI Codex, or Google Jules, but with a distinctive cloud-native infrastructure.

The system uses dedicated EC2 instances as isolated worker environments to run agents asynchronously. These instances are managed and provisioned via AWS CDK (Cloud Development Kit), which provides infrastructure-as-code capabilities. The CDK stacks orchestrate networking, permissions, and lifecycle management of these workers.

A Next.js frontend provides session management, real-time monitoring, and interaction capabilities with running agents. This web interface connects to backend services that orchestrate the EC2 workers and manage agent sessions.

The architecture is serverless-first, relying on AWS Lambda and event-driven patterns for most control plane operations, while the heavy lifting is done by the EC2 workers. This design enables a “fire and forget” model where agents run independently, without tying up local developer resources.

Key integrations include:

  • Amazon Bedrock for large language model (LLM) inference, powering the agent’s AI capabilities.
  • AWS Cognito for authentication and user management.
  • Slack and REST API interfaces for external triggering and notifications.
  • MCP protocol support for agent communication.
  • GitHub integration via personal access tokens or GitHub Apps for autonomous pull request creation and code management.

Deployment typically takes about 10 minutes using CDK bootstrap and deploy commands, making it reasonably accessible for teams familiar with AWS.

what makes this repo’s architecture stand out

The standout aspect of this repo is its architectural pattern: running autonomous AI coding agents in isolated EC2 worker instances orchestrated via AWS CDK. This contrasts with many agent systems that run inline or in ephemeral serverless functions.

This pattern brings several advantages:

  • True asynchronous execution: Each agent runs in a dedicated environment, allowing long-running or resource-intensive tasks without blocking local or shared resources.
  • Scalability: The system can spin up multiple EC2 workers, scaling according to demand.
  • Control and isolation: Workers run in separate instances, reducing resource contention and increasing security.
  • Serverless orchestration: The control and lifecycle management is handled serverlessly via AWS Lambda and event-driven patterns, reducing operational overhead.

The tradeoffs include:

  • AWS lock-in: The stack is heavily tied to AWS services like EC2, Cognito, Lambda, and Bedrock.
  • Infrastructure complexity: Managing CDK stacks, EC2 lifecycle, and permissions can be complex and requires AWS expertise.
  • Cost considerations: EC2 instances running for agents may be more expensive than fully serverless alternatives for low-volume use.

The codebase itself is primarily TypeScript, with clean separation between infrastructure code (CDK stacks), backend APIs, and frontend (Next.js). The use of AWS CDK infrastructure-as-code means the entire environment is reproducible and version-controlled.

quick start

The repository provides clear installation and deployment instructions. Here are the exact steps to get the system running with the web interface:

1. Clone the Repository

git clone https://github.com/aws-samples/remote-swe-agents.git
cd remote-swe-agents

2. Environment Variables Setup

Create a .env.local file from the example template in the cdk directory:

cd cdk
cp .env.local.example .env.local

Edit cdk/.env.local to configure optional settings such as an initial webapp user email for Cognito user creation, worker instance policies, and VPC configuration.

3. Deployment

Use AWS CDK bootstrap and deploy commands to provision the infrastructure and deploy the system. Deployment usually takes about 10 minutes.

This setup enables you to access the Next.js web interface to start and monitor autonomous agent sessions.

verdict

Remote SWE Agents showcases a thoughtful approach to autonomous AI coding agents with a cloud-native infrastructure that prioritizes asynchronous, isolated execution. Its use of dedicated EC2 worker instances managed through CDK is a solid pattern for teams needing scalable, secure agent execution environments.

This repo is well-suited for AWS-savvy teams who want to experiment with autonomous software engineering agents without compromising on isolation or scalability. The tradeoff is in infrastructure complexity and AWS dependency, which may be a barrier for smaller teams or those seeking a lightweight solution.

Its integration with Amazon Bedrock for LLM inference and GitHub for autonomous PRs is practical and demonstrates real-world agent workflows. The Next.js frontend adds a useful layer of observability and control.

Overall, this project is worth understanding for developers exploring autonomous agent infrastructure beyond monolithic or inline execution patterns. The code is clean, the documentation is clear, and the architectural decisions address real scaling and UX challenges in autonomous agent deployment.


→ GitHub Repo: aws-samples/remote-swe-agents ⭐ 233 · TypeScript