---
title: "Execute a script inside the sandbox"
method: POST
path: "/local-sandbox/{local_sandbox_id}/execute"
tags: ["local-sandbox"]
---

# Execute a script inside the sandbox

`POST /local-sandbox/{local_sandbox_id}/execute`

Computes the internal GCS archive URL from the sandbox ID and execution name, then triggers the sandbox executor to download, install dependencies, and execute `main.py`. The execution runs in the background — poll `/execution-logs` to track progress. The archive must first be uploaded via `/execution-upload-url`.

## Path parameters

- `local_sandbox_id` string, required — The local sandbox identifier

## Query parameters

- `region` 'us' | 'asia' — Region hint for GCS upload/download bucket selection. Controls which GCS bucket is used for signed URLs so that users geographically closer to an edge bucket get faster transfers. The data is always pulled to the US GKE cluster over Google's private backbone after upload.

## Request body

- ExecuteRequest
  - `execution_name` string, required — Logical name for this execution (e.g. 'init', 'eval_1')

## Response `200`

Successful Response

- ExecuteResponse
  - `message` string, required
  - `execution_name` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/klavis-ai/apis/klavis-ai-https-www-klavis-ai.md) · [All operations](https://skmtc.net/klavis-ai/apis/klavis-ai-https-www-klavis-ai/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/klavis-ai/klavis-ai-https-www-klavis-ai/revisions/1f05ced7280f/schema)
