# Self-management

The this command lets anything inside a Buddy Sandbox reconfigure that machine - endpoints, apps, snapshots, resources - with no identifier and no token.

From inside a Sandbox you can edit that Sandbox. The `this` command, available on every machine, mirrors `bdy sandbox` but is permanently scoped to the one you are on.

```bash
this --help
```

Two things make it different from running the CLI by hand:

- **No identifier.** The command already knows which Sandbox it is in.
- **No credentials.** The Sandbox is authorized to act on itself.

That combination is what makes it usable by an AI agent. An agent dropped into a Sandbox does not know the machine's name and has no access token - and still needs to expose the dev server it just started.

## What you can do

| Command | Purpose |
| :--- | :--- |
| `this get`, `this status`, `this yaml` | Inspect the current configuration and state |
| `this update` | Change the Sandbox definition |
| `this endpoint` | Add, list, and remove [endpoints](/docs/sandboxes/endpoints.md) |
| `this app` | Manage [applications](/docs/sandboxes/apps.md) |
| `this exec`, `this logs` | Run commands and read [logs](/docs/sandboxes/logs.md) |
| `this snapshot` | Save the current state as a [snapshot](/docs/sandboxes/snapshots.md) |
| `this start`, `this stop`, `this restart`, `this destroy` | Control the [lifecycle](/docs/sandboxes/lifecycle.md) |

Run `this <command> --help` for the exact options of any of them. The help comes straight from `bdy sandbox`, so every signature still lists the `<identifier>` argument you leave out here.

## Typical uses

**Publish what you just started.** A dev server is listening on port 5173 and needs to be reachable:

```bash
this endpoint add -e 5173
```

**Checkpoint before something risky.** Save a known-good state before a migration or a dependency upgrade:

```bash
this snapshot create -n before-upgrade
```

**Keep a process alive.** Promote a command started by hand into a supervised app that survives restarts:

```bash
this app add "npm run worker"
```

**Grow the machine.** Raise resources for a heavier build, then bring them back down. There is no dedicated flag for it - `this update` takes the full YAML definition:

```bash
this yaml > /tmp/sandbox.yml    # edit resources, e.g. to 4x8
this update @/tmp/sandbox.yml
```

**Clean up.** A task-scoped Sandbox can remove itself once the work is done:

```bash
this destroy
```

## Knowing where you are

Built-in variables give scripts the Sandbox context - identifier, SSH address, tags, and endpoint URLs. See [Variables and secrets](/docs/sandboxes/variables-and-secrets.md).

## Next

- [CLI](/docs/sandboxes/cli.md)
- [AI agents](/docs/sandboxes/ai-agents.md)


---
Original source: https://buddy.works/docs/sandboxes/self-management