> For the complete documentation index, see [llms.txt](https://docs.ai.neevcloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ai.neevcloud.com/agentic-studio/overview/security-and-monitoring/internet-access.md).

# Internet Access and Egress

![Diagram: npm install and git push leave the sandbox through an allow\_list egress policy to registry.npmjs.org and github.com, which are allowed. curl uploading .env to paste.io is stopped at the policy because that host is not on the list.](https://1980728309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSqquJG2zKVZ5l1Sd5aQy%2Fuploads%2Fgit-blob-34bd0bdde89e256a41132186583e99f0bb29b6cb%2Fegress.jpg?alt=media)

A sandbox cannot reach the internet unless you allow it to. This is deliberate: a sandbox runs agent-generated and often untrusted code, and the safe default is that such code cannot call out anywhere.

If a package install, a `git clone`, or an API call hangs or fails inside a fresh sandbox, this is almost always why. The sandbox is not broken.

## The Default: Deny All

Every sandbox starts in `deny_all` mode. No outbound connection succeeds. You widen it in one of two ways.

| Policy                                   | Behavior                                               | Use when                                                           |
| ---------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------ |
| `deny_all`                               | No outbound traffic. The default                       | The workload is self-contained                                     |
| `allow_list`                             | Outbound allowed only to the hosts you name            | You know which services the workload needs                         |
| `allow_list` with `allow_internet: true` | Escape hatch. Allows the entire internet (`0.0.0.0/0`) | Exploration, or a workload whose destinations you cannot enumerate |

Prefer `allow_list`. It is the difference between an agent that can reach your package registry and an agent that can reach anything at all. This is what stops a prompt-injected agent from uploading your code or keys to a host you have never heard of.

To set the policy when you create a sandbox, see Fine-Grained Network Egress in [Create, Pause, Delete Sandboxes](https://docs.ai.neevcloud.com/agentic-studio/overview/sandbox-management/create-pause-delete-sandboxes.md). This page covers changing it on a sandbox that is already running.

## Allowing Specific Hosts

Name each host the workload needs. Everything else stays blocked.

{% tabs %}
{% tab title="TypeScript / JavaScript" %}

```typescript
await sandbox.update({
  egress: { mode: "allow_list", allow: [{ host: "api.github.com" }] },
});
```

{% endtab %}

{% tab title="Python" %}

```python
sandbox.update({
    "egress": {"mode": "allow_list", "allow": [{"host": "api.github.com"}]},
})
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl -X PATCH "https://api.ai.neevcloud.com/agent/api/v1beta1/orgs/$NEEV_ORG_ID/projects/$NEEV_PROJECT_ID/sandboxes/$SANDBOX_ID" \
  -H "Authorization: Bearer $NEEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"egress": {"mode": "allow_list", "allow": [{"host": "api.github.com"}]}}'
```

{% endtab %}
{% endtabs %}

Egress rules apply **live, with no restart**. You can tighten or widen a running sandbox's policy without losing your work, which means you can start locked down and open exactly what turns out to be needed.

An update with `egress` **replaces** the existing policy rather than merging into it. Send the complete set of hosts you want allowed, not just the new one.

## Adding or Removing One Host

To change a single destination without restating the whole list, use `egress_add` and `egress_remove`. They edit the current allow list in place, leaving every other rule alone.

{% tabs %}
{% tab title="TypeScript / JavaScript" %}

```typescript
// The sandbox must already be in allow_list mode (see above)
await sandbox.update({
  egress_add: { allow: [{ host: "pypi.org", ports: [443] }] },
});

// Remove one host the same way
await sandbox.update({ egress_remove: { allow: [{ host: "pypi.org" }] } });
```

{% endtab %}

{% tab title="Python" %}

```python
# The sandbox must already be in allow_list mode (see above)
sandbox.update({
    "egress_add": {"allow": [{"host": "pypi.org", "ports": [443]}]},
})

# Remove one host the same way
sandbox.update({"egress_remove": {"allow": [{"host": "pypi.org"}]}})
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl -X PATCH "https://api.ai.neevcloud.com/agent/api/v1beta1/orgs/$NEEV_ORG_ID/projects/$NEEV_PROJECT_ID/sandboxes/$SANDBOX_ID" \
  -H "Authorization: Bearer $NEEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"egress_add": {"allow": [{"host": "pypi.org", "ports": [443]}]}}'
```

{% endtab %}
{% endtabs %}

`egress_remove` is applied before `egress_add`, so one call can swap one destination for another. Neither can be combined with `egress` in the same request, and `egress_add` needs the sandbox to already be in `allow_list` mode. Switch the mode with `egress` first.

## What You Can and Cannot Allow

| Rule                                            | Behavior                                                                                                          |
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `host` as a domain name                         | Matched exactly. `api.github.com` does not also allow `github.com`. Wildcards such as `*.github.com` are rejected |
| `host` as an IP or CIDR                         | Allowed as given                                                                                                  |
| `ports`                                         | Optional. Omit to allow every port on that host                                                                   |
| `protocol`                                      | `TCP` or `UDP`. Defaults to `TCP` when `ports` is set                                                             |
| Private, loopback, and cloud-metadata addresses | Always rejected. A sandbox cannot be pointed back at internal infrastructure                                      |
| `0.0.0.0/0`                                     | Only through `allow_internet: true`                                                                               |

In `deny_all` mode nothing resolves, not even DNS. In `allow_list` mode, DNS lookups resolve for any name. Only the connection is blocked. An unlisted host fails with a connection timeout, not a DNS error.

## Your Agent Cannot Change This

The egress policy is set through the API and SDK with your credentials. The [Sandbox MCP Server](https://docs.ai.neevcloud.com/agentic-studio/overview/integrations-and-support/sandbox-mcp-server.md) has no tool that reads or changes it, so an agent working over MCP cannot widen its own network access, however it is prompted.

## Opening the Whole Internet

{% tabs %}
{% tab title="TypeScript / JavaScript" %}

```typescript
await sandbox.update({ allowInternet: true });
```

{% endtab %}

{% tab title="Python" %}

```python
sandbox.update({}, allow_internet=True)
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl -X PATCH "https://api.ai.neevcloud.com/agent/api/v1beta1/orgs/$NEEV_ORG_ID/projects/$NEEV_PROJECT_ID/sandboxes/$SANDBOX_ID" \
  -H "Authorization: Bearer $NEEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"egress": {"mode": "allow_list", "allow_internet": true}}'
```

{% endtab %}
{% endtabs %}

The SDK option builds this policy for you. Over the API, `allow_internet` only applies in `allow_list` mode, so `mode` must be set: an `egress` with no `mode` is treated as `deny_all`, which ignores `allow_internet` and blocks everything. Like any `egress`, this replaces the existing policy.

Use this while you are finding out what a workload needs, then narrow it to an allow list before you rely on it.

## Common Hosts

Starting points for typical workloads. Verify against what your own build actually contacts.

| Workload              | Hosts to allow                       |
| --------------------- | ------------------------------------ |
| npm install           | `registry.npmjs.org`                 |
| pip install           | `pypi.org`, `files.pythonhosted.org` |
| Go modules            | `proxy.golang.org`, `sum.golang.org` |
| git clone from GitHub | `github.com`, `codeload.github.com`  |
| GitHub API            | `api.github.com`                     |

## Egress and Preview URLs

Egress governs traffic **out** of the sandbox. Preview URLs govern traffic **in**. They are independent: a sandbox in `deny_all` can still serve a preview URL, and a sandbox with full internet access still exposes nothing inbound until you expose a port.

See [Exposing Ports for Preview URLs](https://docs.ai.neevcloud.com/agentic-studio/overview/development-and-connectivity/exposing-ports.md) for inbound access.

## Troubleshooting

| Symptom                                          | Cause                                                                              |
| ------------------------------------------------ | ---------------------------------------------------------------------------------- |
| `npm install` / `pip install` hangs or times out | Registry host not allowed                                                          |
| DNS resolution fails for every name              | The sandbox is still in `deny_all`, which blocks DNS too                           |
| A connection to one host times out               | The host is not in the allow list, or is spelled differently (names match exactly) |
| One host works, another does not                 | The allow list is missing the second host                                          |
| It worked, then stopped after an update          | A policy update replaced the list instead of extending it                          |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ai.neevcloud.com/agentic-studio/overview/security-and-monitoring/internet-access.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
