# Regions

> Choose where sandboxes and agents run, set your account's default, and keep resources together.

A **region** is where a resource runs and keeps its data. NoClick names its regions itself, never after a cloud, so the same name keeps working whatever runs it underneath:

| Region | Where |
| --- | --- |
| `us-east` | The eastern United States, where NoClick itself runs |
| `us-west` | The western United States |
| `eu` | The European Economic Area |
| `ap` | Asia and the Pacific |
| `in` | India, for [machines](https://www.noclick.com/docs/guide/machines.md) only |

```python
import noclick

for region in noclick.regions():
    print(region.name, region.label, region.kinds, "(default)" if region.default else "")
```

```ts
import { regions } from "noclick";

for (const region of await regions()) {
  console.log(region.name, region.label, region.kinds, region.default ? "(default)" : "");
}
```

`noclick.regions(kind="sandbox")` keeps the regions that place a kind of resource. `in` places [machines](https://www.noclick.com/docs/guide/machines.md) (`machine`) alone. Every other region places [sandboxes](https://www.noclick.com/docs/guide/sandboxes.md) (`sandbox`), [agents](https://www.noclick.com/docs/guide/agents.md) (`agent`), [buckets](https://www.noclick.com/docs/guide/storage.md) (`bucket`), [databases](https://www.noclick.com/docs/guide/databases.md) (`database`), [apps](https://www.noclick.com/docs/guide/apps.md) (`project`) and [machines](https://www.noclick.com/docs/guide/machines.md) (`machine`); `us-east` places [browsers](https://www.noclick.com/docs/guide/browser.md) (`browser`), and `eu` and `ap` where the deployment runs them there (for now, NoClick's hosted platform doesn't); and `us-east` alone places [dicts](https://www.noclick.com/docs/guide/dicts.md) (`dict`) and [queues](https://www.noclick.com/docs/guide/queues.md) (`queue`). Reading the list needs the scope of any of them: `sandboxes`, `agents`, `storage`, `databases`, `apps`, `machines`, `browsers`, `dicts`, `queues` or `volumes`.

## Choose one

Pass `region` when you create the resource:

```python
with noclick.Sandbox.create(region="eu") as sb:
    print(sb.region)   # eu

reviewer = noclick.Agent.from_name(
    "reviewer",
    create_if_missing=True,
    instructions="You review pull requests for our EU customers.",
    region="eu",
)
```

```ts
import { Agent, Sandbox } from "noclick";

const sb = await Sandbox.create({ region: "eu" });
try {
  console.log(sb.region);   // eu
} finally {
  await sb.terminate();
}

const reviewer = Agent.fromName("reviewer", {
  createIfMissing: true,
  instructions: "You review pull requests for our EU customers.",
  region: "eu",
});
```

A resource keeps its region for life. An agent's can't change: `Agent.from_name` or `update` asking for another raises `noclick.Conflict` naming the agent's `region`, so create a new agent there instead. So does `Machine.from_name` for a machine's. A name that isn't a region raises `noclick.InvalidRequest`, listing the regions.

Pinning a sandbox costs more: its provider charges 1.15 times as much in `eu` and `ap` and 1.75 times in `us-east` and `us-west`, and so does NoClick, for a [sandbox](https://www.noclick.com/docs/guide/sandboxes.md#limits-and-billing) and for the sandbox an agent on a [coding harness](https://www.noclick.com/docs/guide/agents.md#harnesses) runs in. A [container app](https://www.noclick.com/docs/guide/apps.md) costs more to run in `ap`. Without a region, a sandbox costs the base price.

## Your account's default

Set your account's default region in the console, under Settings. A resource created without `region` takes it, and the region list marks it with `default`. A child agent takes its parent's region before the default. With no region and no default, NoClick runs it wherever it has capacity, and its `region` is `None`: that is how everything ran before regions.

## Keep things together

`region=other.region` puts a resource beside another, so the work between them stays close:

```python
analyst = noclick.Agent.from_name("analyst")
with noclick.Sandbox.create(region=analyst.region) as sb:
    sb.exec("python -c 'print(1 + 1)'")
```

```ts
import { Agent, Sandbox } from "noclick";

const analyst = await Agent.fromName("analyst").hydrate();
const sb = await Sandbox.create({ region: analyst.region ?? undefined });
try {
  await sb.exec("python -c 'print(1 + 1)'");
} finally {
  await sb.terminate();
}
```

## What a region covers

- **A sandbox** runs in its region, and its files are on its own disk there.
- **An agent on a coding harness** runs its whole sandbox in its region: the harness, its shell and files, and its calls to its model provider.
- **An agent on `sdk`** runs its shell (the `code` capability) in its region. Its agent loop runs in NoClick's own service in `us-east`.
- **The `code` capability of a toolkit** runs in your account's default region.
- **A [bucket](https://www.noclick.com/docs/guide/storage.md)** keeps its files in its region, which object storage takes as a location hint: it makes the bucket there when it has room there. Without a region, a bucket takes your account's default, else `us-east`.
- **[Dicts](https://www.noclick.com/docs/guide/dicts.md) and [queues](https://www.noclick.com/docs/guide/queues.md)** keep their data in NoClick's own database, in `us-east`, the one region that places them for now: `region="us-east"`, or none, keeps one there, and another region, or an account default elsewhere, raises `noclick.InvalidRequest` naming `us-east`.
- **[Volumes](https://www.noclick.com/docs/guide/volumes.md)** aren't placed by region yet: the sandbox provider's volume storage keeps every volume's files in the United States and takes no location, so a volume has no region and `region=` on one is in invite-only beta. A sandbox or agent in any region mounts any volume.
- **[Cards](https://www.noclick.com/docs/guide/cards.md)** take no region: they're issued in the US, in dollars, to US businesses, whatever region your account and its users use.

NoClick itself runs in `us-east`: every conversation's history, every operation and the activity log are kept there whatever a resource's region. An agent's workspace files are kept in storage NoClick replicates across regions, so today a region says where work runs, not where an agent's files rest.

## Data, apps and machines

[Databases](https://www.noclick.com/docs/guide/databases.md) and [apps](https://www.noclick.com/docs/guide/apps.md) take `region` the same way, keep it, and fall back to your account's default. With neither, they're kept in `us-east`, since data has to live somewhere. [Machines](https://www.noclick.com/docs/guide/machines.md) are placed the same way. A database and the agent that queries it, side by side:

```python
concierge = noclick.Agent.from_name("concierge")
bookings = noclick.Database.create("bookings", region=concierge.region)
```

```ts
import { Agent, Database } from "noclick";

const concierge = await Agent.fromName("concierge").hydrate();
const bookings = await Database.create("bookings", { region: concierge.region ?? undefined });
```

An app's region places its server code near that region, so put it with the database it binds; its static files are served from everywhere, and its region says nothing about where data stays. That's its database's and bucket's region to say.

[Browsers](https://www.noclick.com/docs/guide/browser.md) and their profiles take `region` too, in a region `noclick.regions(kind="browser")` lists: `us-east` on NoClick's hosted platform for now, and never `us-west` yet. Another region raises `noclick.NotAvailable` naming those that work. A profile's region is where its browsers run; its sign-ins are kept in the US whatever the region.
