What You’ll Learn
- How to create a sandbox with
network={"allow_out": [...]}to restrict outbound access - How to write an agent that tests TCP connectivity from inside the sandbox
- How to verify that non-allowlisted destinations are blocked
- The pattern of combining agent execution with network-level isolation
Prerequisites
- Declaw running locally or in the cloud (see Deployment)
DECLAW_API_KEYandDECLAW_DOMAINset in your environment
This example is available in Python. TypeScript support coming soon.
Code Walkthrough
1. Create the sandbox with a network allow-list
network parameter accepts an object with allow_out (list of allowed domains) or deny_out (list of denied domains). When allow_out is specified, all traffic except to listed domains is blocked. See Network Policies for full details.
2. The agent script — testing connectivity
The agent script runs inside the sandbox and tests TCP connectivity to several hosts:3. Upload the test plan and run the agent
4. Read and analyze results
Expected Output
How Network Policy + Agent Isolation Work Together
Combining with SecurityPolicy
For defense-in-depth, combine network policies with a fullSecurityPolicy: