These guides support organizations that already operate a self-hosted data plane. For new organizations looking to keep data in your own cloud, see Bring your own cloud (BYOC).
- AWS
- GCP
On AWS, the runtime runs as an ECS Fargate service with AWS Lambda MicroVM sandboxes.The runtime requires AWS Terraform module v6.5.2 or later, a supported AWS region, and a Braintrust Gateway for model requests. It is disabled by default, so Loop and Patterns are unavailable until you enable it.The module creates six The module checks that each subnet belongs to the supplied VPC. On v6.10.0 and later, it creates the sandbox security group and the egress gateway endpoint in your VPC, and at least one supplied subnet must share an availability zone with one of the main VPC’s private subnets, or the apply fails. The module doesn’t manage routes in your VPC, so isolating it is your responsibility.DNS restrictions depend on
Supported AWS regions
The Loop runtime is not available in every region supported by the Braintrust data plane. For both self-hosted and BYOC deployments on AWS, it requires regional support for theAWS::Lambda::MicrovmImage CloudFormation resource. The data plane regions that lack this support are ca-central-1, eu-west-2, eu-west-3, and sa-east-1.Enabling the runtime in one of these regions can fail with Template format error: Unrecognized resource types: [AWS::Lambda::MicrovmImage]. Leave enable_loop_runtime set to false there and contact Braintrust for deployment guidance. AWS continues to add MicroVM regions, so confirm coverage for your region with Braintrust.Enable the runtime
Setenable_loop_runtime in your data plane module, then run terraform apply:enable_loop_runtime deploys the ECS service and its sandboxes. It is false by default. It doesn’t require enable_ecs_api. The runtime works with either API routing mode.After the apply completes, Loop is available across your organization.Sandbox egress
On module v6.10.0 and later, sandboxes have no direct outbound access. They reach the network only through the Loop runtime’s egress gateway, which Loop also uses to clone connected GitHub repositories. Sandboxes can clone and fetch repositories, but Loop’s push-and-pull-request workflow isn’t supported.Loop connects to external MCP servers from the Loop runtime service, so those servers must be reachable from it. External MCP connections require data plane v2.17.0 and Terraform module v6.9.0 or later.The module isolates sandboxes with these components:- Sandbox VPC: A dedicated VPC with no outbound route. It uses the
10.255.0.0/16CIDR block by default, which you can change on module v7.0.0 and later. To use a VPC you manage instead, see Supply your own sandbox VPC. - Egress gateway: A proxy on port 4002 of the runtime tasks that authorizes each request. Sandboxes reach it through a PrivateLink interface endpoint in the sandbox VPC.
- DNS firewall: A Route 53 Resolver DNS firewall in the sandbox VPC that allows only the endpoint’s hostname and blocks every other name. The module outputs that hostname as
loop_runtime_sandbox_egress_gateway_dns_name.
loop_runtime_version_override, pin it to v2.16.0 or later, such as "v2.16.0".Choose the sandbox VPC CIDR
On module v7.0.0 and later,loop_runtime_sandbox_vpc_cidr sets the IPv4 CIDR block of the module-created sandbox VPC. It defaults to "10.255.0.0/16" and accepts prefix lengths from /16 through /21:/24 subnets at offsets 1 through 6 within that block: three connector subnets followed by three egress gateway endpoint subnets. The default keeps the VPC and subnet CIDRs of earlier module versions. The variable has no effect when you supply your own sandbox VPC.Supply your own sandbox VPC
On module v6.9.0 and later, sandboxes can use a VPC you manage instead of the module-created one.Set the VPC ID and three distinct private subnet IDs together:loop_runtime_sandbox_manage_existing_vpc_dns_firewall (v6.10.0+, default false):true: The module associates a Route 53 Resolver DNS firewall with your VPC that allows the egress gateway endpoint’s hostname and blocks every other name. The firewall applies to the entire VPC, so use a VPC dedicated to sandboxes.false: The module leaves DNS policy to you. Before sandboxes run, restrict DNS in your VPC so that it resolves only the hostname in theloop_runtime_sandbox_egress_gateway_dns_nameoutput.
Network traffic
- Model requests: The runtime requires a Braintrust Gateway for Loop’s LLM calls. On module v6.5.2 to v6.8.x, it sends them to your deployment’s AI proxy, so set
enable_ai_gateway = trueto have the proxy forward them to your private Gateway. On v6.9.0 and later, it sends them to your private Gateway load balancer whenenable_ai_gateway = true, or to the Braintrust-hosted Gateway whenuse_global_ai_gateway_origin = true. - Runtime to sandboxes: On module v6.9.0 and later, the runtime’s HTTPS and WebSocket connections to active sandboxes go through a
lambda-microvminterface VPC endpoint in your main VPC, with private DNS. The endpoint policy allows connections only to sandboxes in your deployment’s AWS account. Earlier versions don’t create this endpoint. MicroVM management API calls use the standard Lambda service endpoint. - Sandboxes to runtime: On module v6.10.0 and later, sandboxes connect to the runtime’s egress gateway on port 4002 through a PrivateLink endpoint service backed by an internal Network Load Balancer in your main VPC. The endpoint service allows only principals in your deployment’s AWS account. See Sandbox egress.
Scaling
The runtime’s ECS service autoscales on target CPU and memory utilization. On module v6.10.0 and later, it also scales on average claimed conversation utilization, with the target percentage set byloop_runtime_target_conversation_utilization. On v6.10.0 and later, loop_runtime_max_capacity defaults to 50 instead of 4. If you rely on the earlier ceiling to bound cost, set it explicitly.When ECS stops a runtime task on v6.10.0 and later, for example, during scale-in or a deployment, the runtime drains in-progress turns for up to 90 seconds before it shuts down.Telemetry
On module v6.7.0 and later, the Loop runtime sendsmetrics and traces for its own service to Braintrust’s control plane, in addition to whatever telemetry types your deployment configures. Braintrust uses them to diagnose runtime problems while the service stabilizes, and you can’t turn them off while the runtime is enabled.These traces describe the runtime’s operation and can include model and tool identifiers, timing information, and errors. If your deployment can’t send this telemetry, leave the Loop runtime disabled and contact Braintrust.Configuration reference
These variables configure the Loop runtime in the AWS Terraform module.On module v6.8.1 and later, the runtime serves the organization named by
braintrust_org_name. Earlier versions used a separate loop_runtime_org_name variable. Remove it from your configuration before you upgrade, or the plan fails with An argument named "loop_runtime_org_name" is not expected here.Enable Patterns
Patterns requires data plane v2.13 or later. The runtime doesn’t start Patterns. Each project turns Patterns on separately, and the person who does it needs permission to create project automations. See Enable Patterns.Next steps
- Learn what Loop can do once the runtime is running.
- Review thread and sandbox limits that apply to your users.
- Configure networking and connectivity for the rest of your deployment.
See also
Releases and availability- Self-hosting releases: Review release notes and the minimum Terraform or Helm version for each data plane version.
- Feature availability: Find the data plane version each feature requires and which features each cloud supports.
- Architecture: Understand the control plane, data plane, and where data is stored.
- Deploy Braintrust: Deploy the data plane on AWS, GCP, or Azure.
- CloudFormation: Manage a legacy AWS CloudFormation deployment.
- Configure your deployment: Review the settings available after deployment.
- Security and access: Restrict organization access, secure customer data, and harden pods.
- Networking and connectivity: Configure URLs, rate limits, load balancers, and network access paths.
- Scaling and storage: Size API and Brainstore compute.
- Self-host the Braintrust Gateway: Deploy the Gateway in your data plane.
- Loop runtime: Run Loop threads in isolated sandboxes on AWS or GCP.
- Telemetry and data retention: Control telemetry and enable data retention.
- Upgrade your deployment: Follow the routine upgrade process.
- Upgrade to data plane v2.x: Migrate to the data plane v2 series.
- Upgrade to Terraform module v6: Move AWS API traffic from Lambda to ECS.
- Upgrade to Terraform module v7: Route AWS API traffic to ECS and deploy the Gateway by default.