Skip to main content
The Declaw Python SDK is available on PyPI and supports Python 3.10+.

Installation

Environment variables

The SDK reads connection settings from environment variables by default.

ConnectionConfig

ConnectionConfig holds the credentials and endpoint used by every API call. You rarely need to instantiate it directly — Sandbox.create() accepts api_key and domain parameters that build it for you. Use it directly when you need to share connection settings across multiple calls or customise the request timeout.
str
default:"$DECLAW_API_KEY"
API key sent as the X-API-Key header on every request. Defaults to the DECLAW_API_KEY environment variable.
str
default:"$DECLAW_DOMAIN or api.declaw.ai"
Hostname of the Declaw API server. Supports host:port format. Port is parsed from the string and defaults to 443.
int
default:"443"
Explicit port override. Ignored when domain already contains a port.
str | None
default:"None"
Full URL override (e.g. http://localhost:8080). When set, domain and port are not used to construct the URL.
float | None
default:"None"
Default per-request timeout in seconds applied to all HTTP calls made with this config. Individual methods accept a request_timeout parameter that overrides this value.

Sync vs async

The SDK ships two sandbox classes with identical surface areas: Use AsyncSandbox whenever you need to manage multiple sandboxes in parallel or you are running inside an async framework such as FastAPI, LangGraph, or asyncio event loops.

Quick example

What’s exported

The top-level declaw package re-exports every public class, exception, model, and enum: