Commit Graph

53 Commits

Author SHA1 Message Date
Mish Ushakov 2691c73d1c chore(sdk): sync OpenAPI spec from infra, regenerate clients (#1357)
## Summary
- Sync `spec/openapi.yml` from
[e2b-dev/infra@main](https://github.com/e2b-dev/infra/blob/main/spec/openapi.yml)
and re-run `make codegen`.
- Schema changes surfaced in the generated clients:
`SandboxMetric.memCache` (new required int64 — also exposed on the
public `SandboxMetrics` wrapper in both SDKs), `NodeStatus` gains
`standby`, `TeamUser.email` becomes nullable + deprecated, and `POST
/v3/templates` gains a `403` response.
- Upstream-only spec changes (not generated because the client filters
by tag): new `AuthProviderBearerAuth`/`AuthProviderTeamAuth` security
schemes, new admin endpoints for team API keys, and a `clusterID` query
param on `GET /nodes`.

## Test plan
- [x] \`pnpm run format\`, \`pnpm run lint\`, \`pnpm run typecheck\`
- [x] JS \`tests/sandbox/metrics.test.ts\` against the live API
- [x] Python sync + async \`test_metrics.py\` against the live API

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 22:57:28 +02:00
Mish Ushakov c485bf5476 feat(sdk): add Sandbox.updateNetwork / update_network (#1337) 2026-05-26 17:12:29 -07:00
Mish Ushakov 3786f34336 feat(sdk): support structured network rules with per-host transforms (#1286) 2026-05-26 16:35:21 -07:00
Mish Ushakov 6d7e72e3bd feat: add Volume CRUD operations to SDKs (#1126)
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Joe Lombrozo <joe.lombrozo@e2b.dev>
2026-03-25 17:37:46 -07:00
Matt Brockman 7c8d29839a feat (api): Sandbox info lifecycle network (#1213)
extracts the `allow_internet_access`, `lifecycle`, and `network` configs
to the get info responses from the api when present.

Create a sandbox with lifecycle and network rules, check info while
running, pause it, and check info again. Network rules, lifecycle
config, and `allowInternetAccess` all returned while running and paused

```
$ e2b sandbox info xxx --format json

# running
{
  "sandboxId": "xxx",
  "templateId": "xxx",
  "name": "stdin",
  "metadata": {},
  "allowInternetAccess": true,
  "envdVersion": "0.4.3",
  "startedAt": "2026-03-19T01:39:56.238Z",
  "endAt": "2026-03-19T01:44:56.238Z",
  "state": "running",
  "cpuCount": 2,
  "memoryMB": 1024,
  "network": {
    "allowOut": ["api.example.com", "cdn.example.com"],
    "denyOut": ["0.0.0.0/0"],
    "allowPublicTraffic": true
  },
  "lifecycle": {
    "onTimeout": "pause",
    "autoResume": true
  }
}

# paused
{
  "sandboxId": "xxx",
  "templateId": "xxx",
  "metadata": {},
  "allowInternetAccess": true,
  "envdVersion": "0.4.3",
  "startedAt": "2026-03-19T01:39:56.238Z",
  "endAt": "2026-03-19T01:40:27.964Z",
  "state": "paused",
  "cpuCount": 2,
  "memoryMB": 1024,
  "network": {
    "allowOut": ["api.example.com", "cdn.example.com"],
    "denyOut": ["0.0.0.0/0"],
    "allowPublicTraffic": true
  },
  "lifecycle": {
    "onTimeout": "pause",
    "autoResume": true
  }
}
```



<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Updates the public `sandbox info` response shape across OpenAPI, JS,
and Python SDKs, which may impact downstream consumers that assume the
previous schema. Risk is moderate since changes are additive/optional
but touch generated models and response mapping logic.
> 
> **Overview**
> **Sandbox info responses now include network and lifecycle
configuration when present.** The OpenAPI spec and generated JS schema
extend `SandboxDetail` with `allowInternetAccess`, `network`, and a new
`lifecycle` object (with `SandboxOnTimeout` and `SandboxLifecycle`).
> 
> The JS SDK updates `SandboxApi.getFullInfo()` and exported types to
return these fields, introducing `SandboxInfoLifecycle` for info
responses. The Python SDK updates generated client models accordingly,
adds `SandboxLifecycle`/`SandboxOnTimeout` models, and maps
`SandboxDetail.network`/`SandboxDetail.lifecycle` into `SandboxInfo`
(plus exports `SandboxInfoLifecycle`).
> 
> A changeset bumps `@e2b/python-sdk` and `e2b` as minor for the
expanded info payload.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
adb22292c08b1db9c8fe60c702f83fee2695af97. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-03-23 14:48:02 -07:00
Matt Brockman 7027f369a3 autoresume: lifecycle component in sdk (#1146)
Implements the `lifecycle` prop on `Sandbox.create`, taking over and
deprecating the `beta_pause` functionality.

Currently supports:
- `on_timeout`: `kill` (default) | `pause`. Controls what should happen
to the sandbox when it hits end of life. Pause allows for resuming
- `auto_resume`: False (default) | True. Whether the sandbox should
autoresume on traffic

Intended for additional functionality as we update the backend to
support additional props. Blocked from deploying until the API and
client-proxy are deployed but for pre-approval.

(Meant to be extended later as add more capabilities to the API)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes the API contract and request payload shape for sandbox
auto-resume and alters lifecycle/timeout behavior mapping, which could
break older integrations if backend/client versions are mismatched.
> 
> **Overview**
> Adds a new `lifecycle` configuration on `Sandbox.create` (JS + Python)
to control what happens at timeout (`kill` vs `pause`) and whether
paused sandboxes auto-resume on traffic (`auto_resume`).
> 
> Deprecates `betaPause`/`beta_pause` and the JS `autoPause` create
option in favor of the new lifecycle semantics, updates connect/pause
call paths accordingly, and expands tests to cover resume-on-connect and
auto-resume behaviors.
> 
> Updates the OpenAPI contract and generated clients so `autoResume` is
now an object with an `enabled: boolean` flag (removing the previous
policy enum), and bumps SDK versions via a changeset.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
515f9b7fc13a5ec13db75450e8f6252e3c7bcf03. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-03-04 13:23:08 -08:00
Jakub Dobry a55ca219e9 feat: snapshots (#1111) 2026-02-24 11:59:11 -08:00
Jakub Dobry 631522d74a feat: use v2 template update endpoint with namespaced templates (#1105) 2026-01-29 07:01:41 -08:00
Jakub Dobry 10abab8e96 feat: add template versioning with tags support for JS and Python SDKs (#1080) 2026-01-27 13:41:24 +00:00
Jiri Sveceny d8ef36d84f Support Template.aliasExists for JavaScript and Python SDKs (#1068)
Integration tests will fail until the feature is deployed in E2B Cloud
production.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Enables checking template alias availability from both SDKs.
> 
> - JS: Implements `checkAliasExists` in `template/buildApi.ts`, exposes
`Template.aliasExists` in `template/index.ts`, adds `AliasExistsOptions`
type and tests
> - Python: Adds `Template.alias_exists` and
`AsyncTemplate.alias_exists` wired to generated
`get_templates_aliases_{alias}` client; includes sync/async tests
> - API: Regenerates schemas/clients to include `GET
/templates/aliases/{alias}`, template build logs endpoint and
parameters, and supporting models (e.g., `TemplateAliasResponse`)
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4e577fd77888478ac83b66db7537cd2355ea050b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 10:05:48 +00:00
Jakub Dobry 4c612888d4 feat: implement network out allow/deny list support (#1016) 2025-11-15 22:35:09 +00:00
Jakub Novák 423d87cf91 Update spec and templates to use /v3/ endpoint (#1002)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Switches SDKs to the /v3 template build API and updates spec with
sandbox connect, team max metrics, and related schema changes while
deprecating legacy endpoints.
> 
> - **API Spec / Schema**:
> - **Templates v3**: Add `POST /v3/templates` with
`TemplateBuildRequestV3` → `TemplateRequestResponseV3`; deprecate `POST
/templates`, `POST /templates/{templateID}`, and `POST /v2/templates`
(now return `TemplateLegacy`).
> - **Sandbox Connect**: Add `POST /sandboxes/{sandboxID}/connect` with
`ConnectSandbox`; mark `POST /sandboxes/{sandboxID}/resume` as
deprecated.
> - **Team Metrics**: Add `GET /teams/{teamID}/metrics/max` returning
`MaxTeamMetric`.
> - **Schema updates**: `Template` now includes `buildStatus`
(`TemplateBuildStatus`); `BuildLogEntry.step`;
`BuildStatusReason.logEntries`; `NodeStatusChange.clusterID`; replace
`McpConfig` with nullable `Mcp`; add `timestampUnix` to metrics and
deprecate `timestamp`.
> - **JS SDK**:
> - Update template build request to `POST /v3/templates` in
`template/buildApi.ts`.
> - Regenerate `schema.gen.ts` reflecting new endpoints/types and
deprecations.
> - **Python SDK**:
> - Add client for `POST /v3/templates`; switch sync/async build APIs to
use `TemplateBuildRequestV3` and new response type.
>   - Add client for `POST /sandboxes/{sandboxID}/connect`.
> - Introduce/adjust models: `TemplateBuildStatus`,
`TemplateRequestResponseV3`, `TemplateLegacy`, `ConnectSandbox`,
`MaxTeamMetric`, `McpType0`, and metric timestamp fields.
> - **Meta**:
>   - Changesets: patch bumps for affected packages.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4672fbf655ae3e508bf375dc58a89299e19f0664. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-31 01:53:02 -07:00
Jonas Scholz d7d55df930 Add mcp to request body (#961)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds `mcp` config support for sandbox creation across API, JS, and
Python SDKs, and updates timeout tests to use explicit request timeouts.
> 
> - **API/OpenAPI**:
> - Add `McpConfig` schema and `mcp` field to `NewSandbox` in
`spec/openapi.yml` and generated TS `schema.gen.ts`.
> - **JS SDK**:
> - `SandboxApi.createSandbox` sends `mcp` in POST body
(`packages/js-sdk/src/sandbox/sandboxApi.ts`).
>   - Types updated to include `components["schemas"]["McpConfig"]`.
> - **Python SDK**:
> - Extend `NewSandbox` model and sandbox create flow to accept/pass
`mcp`; async/sync APIs propagate `mcp` to POST `/sandboxes`.
> - **Tests**:
> - Increase `is_running` request timeouts in timeout tests to reduce
flakiness (JS and Python).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
04ad4e6d4947e33523b74aba2f703fa1e9c05e72. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-17 12:31:32 -07:00
Mish Ushakov 67070bb9ea Synced spec + generated API client (#889)
Changelog

- Synced latest spec from e2b-dev/infra
- Regenerated API clients
2025-09-03 05:43:47 -07:00
Jakub Novák cf0bb40ed3 Fix autopause (#876)
# Description

Autopause option shouldn't be passed for resume
2025-09-03 11:48:12 +00:00
Jakub Novák 74457ff1dd SDK v2 - Changeset and docs (#862)
SDK v2 release
2025-08-21 08:45:25 -07:00
Jakub Novák 1aee7c8195 Refactor Sandbox object in Python (#855)
# Description

We can simplify typing and return only SandboxInfo in SDKs as the types
are very similar (there are some extra fields in detail, which we don't
want to expose but we need them e.g. for connect)
2025-08-10 12:40:09 -07:00
Jakub Novák f123091e9a Allow to block network from SDK (#834)
# Description

This pull request introduces the ability to control internet access for
sandboxes, enhancing security for sensitive workloads.
2025-07-31 02:34:57 -07:00
Jakub Novák 706ebd9af8 Fix generating files with docker (#829)
# Description

Fixes an issue in generating files in Docker. There has been an
incompatibility of `buf` (version `29.5`) and `protoc-gen-es` (version
`2.2.2`).

I updated `protoc-gen-es@` to `2.6.2`

Also refactored the code a little so it's easier to read
Added a CI pipeline job to check all files are properly generated
2025-07-28 13:47:26 +02:00
Jiri Sveceny 10e9a28a82 Support sandbox domain in sdk and cli (#821)
Support sandbox traffic routing to the custom domain returned from API.
2025-07-18 13:15:12 +02:00
Jiri Sveceny 2def1305f3 Flag for securing envd access with auth token (#688)
Waiting until secure flag will be available in production cluster.

---------

Co-authored-by: Jakub Novák <jakub@e2b.dev>
2025-05-14 15:15:18 +00:00
Jakub Novák 5c4d07536f Add filtering option for listing sandboxes (#532)
# Description

Allow users to filter out sandbox based on metadata

---------

Co-authored-by: Mish Ushakov <10400064+mishushakov@users.noreply.github.com>
2025-03-21 15:57:48 +01:00
Jakub Novak 594bb174d2 Generate only relevant api routes for the client in SDKs 2025-01-17 11:01:40 -08:00
Mish Ushakov fc8086dcf5 Changed template ls command to sync with latest API changes (#508)
- Added createdBy, createdAt columns
- Hidden 'buildCount', 'lastSpawnedAt', 'spawnCount', 'updatedAt'
columns
- Sync API spec and ts schema to latest

---------

Co-authored-by: Mish Ushakov <mishushakov@users.noreply.github.com>
Co-authored-by: Jakub Novák <jakub@e2b.dev>
2024-12-17 11:35:20 +01:00
Jakub Novak b38e0ee2a4 Fix env vars type 2024-08-14 13:12:01 +02:00
Jakub Novak 2357fa3da7 Add possibility to add env vars on sandbox create 2024-08-14 11:08:25 +02:00
Tomas Valenta 41703374c0 Merge branch 'grpc' into beta 2024-06-28 11:10:10 -07:00
Jakub Novak dd8960c572 Add check if template has envd V2 2024-06-26 12:51:12 +02:00
Tomas Valenta 955876ef29 Fix openapi specs 2024-06-24 21:59:12 -07:00
Tomas Valenta 5bfcc9a20e Imrpove connection config; [WIP] Rework Python SDK 2024-06-01 21:07:13 +02:00
Tomas Valenta 068ff5613f Regenerate APIs 2024-05-31 06:40:42 +02:00
Tomas Valenta 3b4c915a48 Generate clients 2024-05-17 02:05:12 -07:00
Tomas Valenta 34adeb29d2 Update spec/openapi.yml
Co-authored-by: Jakub Novák <jakub@e2b.dev>
2024-04-05 16:30:42 -07:00
Tomas Valenta 8f784c210f Fix logs response handling 2024-04-04 14:20:36 -07:00
Tomas Valenta f00c58658e Regenerate logs endpoint from API spec 2024-04-04 13:44:55 -07:00
Tomas Valenta e24a494969 Add basic logs command 2024-04-03 16:12:40 -07:00
Jakub Novák 2bafaf0db4 Switch the template build to local (#338)
Change CLI to build the docker image locally
2024-03-24 10:12:43 -07:00
Jakub Novak 1801039dbf Add info about memory and cpus to sandbox list 2024-02-28 06:57:27 -08:00
Vasek Mlejnsky 710f227b85 Document process for customizing sandbox compute (#322)
Co-authored-by: Tomas Valenta <valenta.and.thomas@gmail.com>
Co-authored-by: Jakub Novak <jakub@e2b.dev>
2024-02-27 21:43:48 -08:00
Jakub Novák 7fe1d3b569 Rename api endpoints (#298) 2024-02-02 18:57:40 +01:00
Jakub Novak 363b577c69 Add alias to list command 2024-01-30 10:56:25 +01:00
Jakub Novák 34f49ca350 List running sandboxes (#297) 2024-01-29 17:10:11 +01:00
Tomas Valenta 962b867c97 Add delete command to CLI 2023-11-20 13:31:41 +01:00
Jakub Novak f636bdb997 Fix minor issues, raise error on incorrect values 2023-11-16 09:45:12 +01:00
Jakub Novak 89d90f86db Update schema 2023-11-16 09:45:11 +01:00
Jakub Novak cc39593e3d Regenerate python client 2023-11-16 09:45:10 +01:00
Jakub Novak 3c2fc9faf5 Regenerate clients 2023-11-09 17:04:18 +01:00
Jakub Novak 9b3a162b39 Update openapi spec 2023-11-09 11:09:17 +01:00
Jakub Novak 2e1da46935 Update openapi spec 2023-11-09 11:06:37 +01:00
Tomas Valenta 417035073c Update JS SDK generated API client 2023-11-08 12:35:05 +01:00