Skip to main content

Prerequisites

  • A Declaw Cloud account — sign up at declaw.ai to get an API key
  • DECLAW_API_KEY and DECLAW_DOMAIN environment variables set (see Deployment)
Enterprise on-prem customers receive their own DECLAW_DOMAIN from the Declaw team during provisioning. Everything else in this guide is identical.
1

Install the SDK

Requires Python 3.10 or later. The package includes both synchronous (Sandbox) and asynchronous (AsyncSandbox) clients.
2

Set environment variables

DECLAW_DOMAIN is the hostname of the Declaw API server (api.declaw.ai for Declaw Cloud). DECLAW_API_KEY authenticates your requests. Both are picked up automatically by the SDK — you do not need to pass them explicitly to Sandbox.create().
Get your API key from your dashboard at declaw.ai. Enterprise on-prem customers will receive their own domain and key.
3

Create a sandbox and run a command

Sandbox.create() boots a sandbox and returns once the VM is ready. commands.run() executes the command inside the VM and blocks until it completes. sbx.kill() destroys the VM and releases all resources.
4

Write a file and run a script

5

Add a security policy

Attach a SecurityPolicy at creation time to enable PII redaction, prompt injection defense, network restrictions, and audit logging.
With this policy:
  • Any HTTP request leaving the sandbox that contains a credit card number, SSN, email address, or phone number will have those values replaced with [REDACTED_*] tokens before reaching the external server.
  • The injection defense model scores every outbound LLM API call and blocks requests above the detection threshold.
  • Only api.openai.com and pypi.org can be reached. All other outbound connections are dropped.
  • Every security event is written to the audit log.
6

Next steps

You have created a sandbox, run commands and filesystem operations, and applied a security policy. Where to go next:
  • Concepts — understand the architecture: sandbox VMs, envd, the security proxy, and how they fit together.
  • Installation — detailed SDK setup, ConnectionConfig, and all configuration options.
  • Security overview — the full SecurityPolicy object and all available security controls.
  • Cookbook — 49 working examples covering LLM integrations, framework adapters, PII rehydration, agent-in-sandbox patterns, and security demos.