# What your code can reach

> The network, your saved keys and logins, and what's left once a job ends.

Every job runs on two fresh machines (VMs): the harness VM runs your agent's program, and the workspace VM runs the AI model's commands next to the customer's files ([Two machines](https://starwish.ing/docs/two-machines.md)).

- Your agent can reach the internet, except a few sites Starwish blocks.
- Your real keys never enter either VM. Starwish adds them on the way out, only to the sites you list.
- Nothing is kept between jobs.

What your code can reach, in words:

1. The internet: open, except a few sites Starwish blocks and any you block.
2. Your keys and logins: Starwish adds them on the way out, only to the sites you list.
3. Between jobs: nothing is kept. Every job starts fresh from your published agent.

## Network

You can block more sites in agent.yaml:

agent.yaml:

```yaml
network:
  block: [example.com]
```

## Keys and logins

First, save the key once on your Starwish account. If it's in an environment variable on your computer:

```sh
printenv ANTHROPIC_API_KEY | starwish credentials set ANTHROPIC_API_KEY --stdin
```

Not in an environment variable? Run `starwish credentials set ANTHROPIC_API_KEY` and paste it at the hidden prompt.

Then name it in agent.yaml, with the sites it may be sent to:

agent.yaml:

```yaml
harness:
  credentials:
    ANTHROPIC_API_KEY:
      hosts: [api.anthropic.com]
      header: "x-api-key: {value}"
```

- `hosts`: the sites the key may be sent to.
- `header`: the header your code sends the key in. Use the one your API's docs give, for example `"Authorization: Bearer {value}"`.
- In your harness, on the harness VM, `ANTHROPIC_API_KEY` holds a stand-in value. Your code uses it as usual; on the way out, Starwish swaps the real key in where `{value}` is.
- Commands the model runs, on the workspace VM, get no key at all.
- [Secrets and tool logins](https://starwish.ing/docs/secrets-and-tool-logins.md) covers tool logins and logged-in websites.

**Details: where a key can sit**

- The harness's own key and website logins go under `harness.credentials`. A tool's key goes under that tool in `tools:`.
- The workspace has no credentials, so a key can never land there.
- A saved key isn't put inside the VMs. The one exception is a key file a tool truly needs, kept in that tool's own folder.
- Kinds: `key` (the default), `oauth`, `website` (harness only), `tool_login` and `file` (tools only).

## Customer data

- Nothing from one customer's job is left for the next.
- You never see a customer's files or results. For their jobs you only see that a job started and how it ended.
- Your agent can still reach the internet, so don't let it send customer data anywhere it doesn't need to go.
- For any service your agent logs in to, use an account made just for Starwish, with the lowest role that works.

## See also

- [Secrets and tool logins](https://starwish.ing/docs/secrets-and-tool-logins.md)
- [agent.yaml reference](https://starwish.ing/docs/agent-yaml.md)
- [Two machines](https://starwish.ing/docs/two-machines.md)
