Skip to main content

Use case

Every sandbox exposes a set of path-based URLs under api.declaw.ai for interacting with its filesystem, ports, and MCP endpoint. This example exercises each URL helper and round-trips a 50 MiB payload through the upload/download endpoints to verify streaming works end-to-end.
All URLs are path-based under api.declaw.ai. Subdomain-style URLs (<id>.api.declaw.ai) are not supported.

What you’ll learn

  • Using envd_api_url to get the base namespace URL for a sandbox
  • Building download and upload URLs with download_url(path) / upload_url(path)
  • Using get_host(port) for port-based reverse-proxy URLs
  • Using get_mcp_url() for the MCP convenience endpoint
  • Round-tripping a large payload through upload_url + download_url with SHA-256 verification

Prerequisites

Code walkthrough

Create a sandbox and print all five URL helpers:
Round-trip a 50 MiB payload through the raw file streaming endpoints:
Port proxy — start a server inside the sandbox and access it through get_host():

Expected output

Full source

See cookbook/examples/url-helpers/main.py in the repo.