> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notte.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Managed Agents

> Give Anthropic's hosted agents a Notte browser, with your key held in a vault

<Tip>
  STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md).

  Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch.

  Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages.

  Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code.

  SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior.
</Tip>

[Claude Managed Agents](https://docs.claude.com/en/api/agent-sdk/overview) run in Anthropic-hosted sandboxes. Those sandboxes have a shell but no browser, so give them the [notte CLI](https://github.com/nottelabs/notte-cli) and they can drive real browsers - many at once, one per subagent - while your API key stays in a vault the model never reads.

## Prerequisites

* An `ANTHROPIC_API_KEY` with Managed Agents access
* A Notte API key ([get one here](https://console.notte.cc))
* Node 22 or later

## 1. Install the SDK

```bash theme={null}
npm install @anthropic-ai/sdk
```

## 2. Create the environment and vault

The environment is the sandbox image. The vault holds your Notte key and substitutes it into outbound requests, so the key never appears in the model's context.

<CodeGroup>
  ```typescript setup.ts theme={null}
  import Anthropic from "@anthropic-ai/sdk";

  const client = new Anthropic();

  // 1. An environment with the notte CLI baked into the image.
  //    allow_package_managers covers npm and PyPI but NOT the Go module proxy,
  //    so the Go toolchain hosts have to be allowed explicitly or the install
  //    silently produces no binary.
  const env = await client.beta.environments.create({
    name: "notte-browser-env",
    config: {
      type: "cloud",
      packages: { go: ["github.com/nottelabs/notte-cli/cmd/notte@latest"] },
      networking: {
        type: "limited",
        allow_package_managers: true,
        allowed_hosts: [
          "api.notte.cc",
          "*.notte.cc",
          "proxy.golang.org",
          "sum.golang.org",
          "storage.googleapis.com",
        ],
      },
    },
  });

  // 2. A vault holding NOTTE_API_KEY. The sandbox env var carries an opaque
  //    placeholder; the real value is substituted into outbound requests only
  //    when they are addressed to allowed_hosts, so the model never sees it.
  const vault = await client.beta.vaults.create({ display_name: "Notte vault" });

  const credential = await client.beta.vaults.credentials.create(vault.id, {
    display_name: "Notte API key",
    auth: {
      type: "environment_variable",
      secret_name: "NOTTE_API_KEY",
      secret_value: process.env.NOTTE_API_KEY!,
      networking: { type: "limited", allowed_hosts: ["api.notte.cc", "*.notte.cc"] },
    },
  });

  console.log(env.id, vault.id, credential.id);
  ```
</CodeGroup>

## 3. Run an agent

<CodeGroup>
  ```typescript run.ts theme={null}
  // packages.go drops the binary in $(go env GOROOT)/bin, which is not on PATH.
  // Every shell command that calls notte must prepend this.
  const PATH_FIX = 'export PATH="$PATH:$(go env GOROOT)/bin:$(go env GOPATH)/bin"';

  const agent = await client.beta.agents.create({
    name: "browser-operator",
    environment_id: env.id,
    vault_id: vault.id,
    system_prompt:
      `You drive real browsers with the notte CLI. ` +
      `Prefix every shell command with: ${PATH_FIX}`,
  });

  const run = await client.beta.agents.runs.create(agent.id, {
    input: "Open https://example.com and report its main heading.",
  });

  console.log(run.id);
  ```
</CodeGroup>

## Two networking planes

These are easy to confuse and they do different jobs.

**Environment networking** is a firewall on the container. It decides which hosts the sandbox can reach at all, at build time and at run time. The Go module proxy belongs here: `allow_package_managers` covers npm and PyPI but not `proxy.golang.org`, so without those hosts the image builds with Go present and no `notte` binary.

**Credential networking** decides where a secret may be substituted. Scope it to the hosts that actually consume the key, so a prompt injection cannot exfiltrate it to an attacker's domain.

<Warning>
  `packages.go` installs the binary into `$(go env GOROOT)/bin`, which is not on `PATH` - `PATH` carries `/usr/local/go/bin` while `GOROOT` is a versioned directory. Every shell command that calls `notte` has to prepend the fix shown above, or the agent will report that the command was not found.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Claude Code" icon="code" href="/integrations/claude-code-ai-agents">
    Use Notte from Claude Code instead
  </Card>

  <Card title="MCP Server" icon="plug" href="/mcp-server">
    Connect over MCP rather than the CLI
  </Card>

  <Card title="Browser Agents" icon="robot" href="/concepts/agents">
    Hand a whole task to a Notte agent
  </Card>

  <Card title="Vaults" icon="key" href="/concepts/vaults">
    Notte's own credential store
  </Card>
</CardGroup>
