# Cursor local GCP sandbox

> Point Cursor agent workflows at LocalCloud to test Google Cloud code locally with Docker, repo-aware prompts, and a clear production validation step.
>
> Source: https://local.cloud/agents/cursor-gcp-sandbox/

Cursor sandbox

Cursor is useful when the agent can reason over an IDE workspace and edit files quickly. LocalCloud gives those edits a concrete local GCP target so agent-written code can be exercised through Google Cloud SDKs before a human pushes to a real project.

[Read docs](https://local.cloud/docs/) [Check compatibility](https://local.cloud/compatibility/) [SDK examples](https://local.cloud/docs/sdk-examples/)

Fact

Best for workspace-aware edits plus an integrated terminal test loop.

Fact

Keep emulator env vars in the terminal/session running tests.

Fact

Use repository-local instructions to prevent real-cloud fallbacks.

IDE caveat

## The editor and terminal may not share state

Cursor can edit files and run commands, but environment variables must be present in the process that executes tests. Have the agent echo emulator env vars immediately before the SDK check.

Repo instruction

## Prefer a project-local note once proven

After the first successful LocalCloud run, ask Cursor to add concise project instructions only if the repository already uses an agent instruction file. The instruction should say localhost endpoints are the default local test target and production deploys require real GCP validation.

Copy-ready setup

## Commands and prompts

### Copy a prompt for your coding agent

#### Configure this repo

Have an agent wire an existing project to LocalCloud safely.

```
Set up this repository to use LocalCloud for local GCP development. First read https://local.cloud/ai/agents.md, then inspect this repo, identify the GCP services and SDK language, configure emulator environment variables, and run the narrowest integration test against localhost. Do not use real GCP credentials or production endpoints.
```

#### Start LocalCloud

Give an agent one URL and have it start the local GCP sandbox.

```
Fetch https://local.cloud/ai/agents.md and follow the instructions to start LocalCloud on my machine. Install the LocalCloud CLI if it is missing, verify Docker, start or reuse LocalCloud, export emulator environment variables, and run one local GCP SDK/API smoke check. Do not ask for or use real GCP credentials.
```

#### Troubleshoot routing

Diagnose why SDKs or Terraform are still reaching real Google Cloud.

```
Troubleshoot my LocalCloud setup. Read https://local.cloud/ai/agents.md, check whether Docker and the localcloud container are healthy, verify emulator environment variables are set in this shell/test runner, and identify any SDK or Terraform configuration that could still call real Google Cloud.
```

Cursor agent prompt

```
Inspect this workspace for Google Cloud SDK usage. Use https://local.cloud/ai/agents.md to start LocalCloud, set emulator env vars in the terminal that will run tests, and validate one local operation. Do not add real GCP credentials or production project IDs.
```

Production boundary

## Before production

Use LocalCloud for non-production development, testing, and CI under the [Public Preview License](https://local.cloud/license/), check [each service's local boundaries](https://local.cloud/compatibility/), and validate against real Google Cloud before you deploy.

- Cursor-specific background agent environments can differ from the visible terminal.
- Do not store fake local env vars in files that production jobs source without safeguards.

Related

## Next steps

- [SDK examples](https://local.cloud/docs/sdk-examples/) — Use standard Google Cloud SDKs pointed at localhost.
- [Seed data](https://local.cloud/docs/seed-data/) — Load deterministic fixtures for repeatable agent and CI runs.
