Network Policies allow you to control what network resources your Devboxes can access. By default, Devboxes have unrestricted network access. Network Policies let you restrict egress traffic to specific hostnames, block all external access, or allow communication between your Devboxes.Documentation Index
Fetch the complete documentation index at: https://docs.runloop.ai/llms.txt
Use this file to discover all available pages before exploring further.
Why Use Network Policies?
Network Policies are essential for:- Security: Limit network access to only the services your AI agent needs (e.g., specific APIs, package registries)
- Compliance: Ensure Devboxes can only communicate with approved endpoints
- Cost Control: Prevent unexpected network charges from unrestricted access
- Isolation: Control whether Devboxes can communicate with each other
Network Policy Configuration
A Network Policy defines egress rules with the following options:| Option | Description |
|---|---|
name | A unique, human-readable name for the policy |
allow_all | If true, allows all egress traffic (overrides other settings) |
allowed_hostnames | List of DNS hostnames to allow, with wildcard support |
allow_devbox_to_devbox | If true, allows traffic between your account’s Devboxes via tunnels |
allow_agent_gateway | If true, allows devbox egress to Agent Gateways for credential proxying |
allow_mcp_gateway | If true, allows devbox egress to MCP Hub for MCP server access |
description | Optional description for the policy |
Hostname Wildcards
You can use wildcards in the first label of hostnames:github.com- Allow only github.com*.github.com- Allow all subdomains of github.com*.npmjs.org- Allow all subdomains of npmjs.org
Limits
You can create up to 100 network policies per account. If you need more, please contact support@runloop.ai.Creating a Network Policy
Policy Types
Allow All (Default Behavior)
Allows unrestricted network access:Deny All
Block all external network access by settingallow_all=False with an empty hostname list:
Allow Specific Hosts
Restrict access to only the services your agent needs:Allow Devbox-to-Devbox Communication
Enable traffic between your Devboxes via tunnels:Allow Agent Gateway and MCP Hub Access
When using Agent Gateways or MCP Hub with a restrictive network policy, you must explicitly enable access to those services. These are dedicated toggles — you do not need to add Runloop hostnames toallowed_hostnames.
If
allow_all is true, Agent Gateway and MCP Hub access are automatically permitted. These toggles only matter when allow_all is false.Applying Network Policies
Network policies can be applied at multiple levels:Apply to a Devbox
Apply a policy when creating a Devbox usingnetwork_policy_id inside launch_parameters:
Apply to a Blueprint
Blueprints support two types of network policy application:- Build-time policy (
network_policy_idat top level): Restricts network access during the blueprint build process - Runtime policy (
launch_parameters.network_policy_id): Applies to all Devboxes created from the blueprint
Override Blueprint Policy
When creating a Devbox from a Blueprint, you can override the inherited runtime policy:Managing Network Policies
List Policies
Get Policy Details
Update a Policy
When you update a network policy, all running Devboxes and Blueprints using that policy will be updated. Changes are eventually consistent and may take a few moments to propagate to all resources.
Delete a Policy
Common Use Cases
AI Agent with API Access
Allow access to code repositories, package registries, and Runloop services (Agent Gateway for LLM API proxying, MCP Hub for tool access):Multi-Devbox Workflow
Allow Devboxes to communicate with each other for distributed workloads:Best Practices
- Start Restrictive: Begin with a deny-all policy and add only the hosts your agent needs.
- Use Wildcards Carefully:
*.example.comallows all subdomains, which may be broader than intended. - Name Policies Descriptively: Use names that indicate the policy’s purpose (e.g.,
ai-agent-production,eval-restricted). - Document Policies: Use the description field to document why specific hosts are allowed.
- Audit Regularly: Review policies periodically to remove unnecessary access.
- Use Blueprint Inheritance: Apply policies to Blueprints for consistent security across Devboxes.
- Test Policies: Before deploying to production, test that your agent can access all required services.
