Commit Graph

4479 Commits

Author SHA1 Message Date
Mish Ushakov 44365999e1 Vendor strip-ansi npm module to avoid ESM-related issues (#895)
- Fixes #894
e2b@2.1.2
2025-09-08 08:17:25 +03:00
github-actions[bot] bee91610dc [skip ci] Release new versions 2025-09-06 10:58:21 +00:00
Jakub Dobry 6fc97604f7 Add ready command for JS and Python (#893) @e2b/python-sdk@2.1.1 e2b@2.1.1 2025-09-06 03:52:42 -07:00
github-actions[bot] 9d82bd60fc [skip ci] Release new versions 2025-09-05 20:06:19 +00:00
Mish Ushakov 4a2a6c7051 Add Templates SDK (#871)
### Merge Templates SDK into E2B SDK.

This PR merges code from Templates SDK to E2B SDK.

**Changelog**

- Added new error classes: BuildError, FileUploadError.
- Added template API endpoints to API Client generation (Python).
- Updated API Clients error handling to throw BuildError in addition to
SandboxError.
- Exported Template and TemplateAsync classes.
- Moved `getRuntime` utility method from api to utils.
- Browser is supported except file operations (COPY). Incompatible
modules are not bundled, using dynamic imports (tar, glob) in supported
environments (Node, Deno, Bun) instead.
- Basic tests were added, subject to expansion in a follow-up PR.
- Breaking: Before, 401 error was raising `SandboxError`, which was
incorrect, now it will raise `AuthenticationError`. I have also changed
the `AuthenticationError` to extend Error class, not `SandboxError`
anymore as it's now thrown by both Sandbox and Template.

**Usage**

JavaScript

```js
import { Template } from 'e2b';

const template = Template()
  .fromImage('ubuntu:22.04')
  .copy('folder/*.txt', 'folder', { forceUpload: true })
  .setEnvs({
    ENV_1: 'value1',
    ENV_2: 'value2',
  })
  .runCmd('cat folder/test.txt')
  .setWorkdir('/app')
  .setStartCmd('echo "Hello, world!"', Template.waitForTimeout('10s'))

await Template.build(template, {
  alias: 'test-template',
  cpuCount: 1,
  memoryMB: 1024,
  onBuildLogs: (logEntry) => console.log(logEntry.toString()),
})

```

Python

```py
from e2b import Template

template = (
    Template()
    .from_image("ubuntu:22.04")
    .copy("folder/*.txt", "folder", force_upload=True)
    .set_envs(
        {
            "ENV_1": "value1",
            "ENV_2": "value2",
        }
    )
    .run_cmd("cat folder/test.txt")
    .set_workdir("/app")
    .set_start_cmd("echo 'Hello, world!'", Template.wait_for_timeout("10s"))
)

Template.build(
    template,
    alias="test-template",
    cpu_count=1,
    memory_mb=1024,
    on_build_logs=lambda log_entry: print(log_entry),
)
```

Python Async

```py
from e2b import AsyncTemplate

template = (
    AsyncTemplate()
    .from_image("ubuntu:22.04")
    .copy("folder/*.txt", "folder", force_upload=True)
    .set_envs(
        {
            "ENV_1": "value1",
            "ENV_2": "value2",
        }
    )
    .run_cmd("cat folder/test.txt")
    .set_workdir("/app")
    .set_start_cmd("echo 'Hello, world!'", Template.wait_for_timeout("10s"))
)

await AsyncTemplate.build(
    template,
    alias="test-template",
    cpu_count=1,
    memory_mb=1024,
    on_build_logs=lambda log_entry: print(log_entry),
)
```

---

Merge progress

- [x] JavaScript SDK
- [x] Python SDK
- [x] Tests
- [x] Split files for review
@e2b/python-sdk@2.1.0 e2b@2.1.0
2025-09-05 22:00:22 +02:00
github-actions[bot] 2162c6191f [skip ci] Release new versions 2025-09-03 12:49:17 +00:00
Mish Ushakov 67070bb9ea Synced spec + generated API client (#889)
Changelog

- Synced latest spec from e2b-dev/infra
- Regenerated API clients
@e2b/cli@2.0.3 @e2b/python-sdk@2.0.2 e2b@2.0.3
2025-09-03 05:43:47 -07:00
github-actions[bot] 787a3192ce [skip ci] Release new versions 2025-09-03 12:01:10 +00:00
Jakub Novák cf0bb40ed3 Fix autopause (#876)
# Description

Autopause option shouldn't be passed for resume
e2b@2.0.2 @e2b/python-sdk@2.0.1
2025-09-03 11:48:12 +00:00
github-actions[bot] 0070938d01 [skip ci] Release new versions 2025-09-01 07:47:17 +00:00
Jakub Novák 99b9ed768d Deprecate spawn instead of remove (#885)
Adds a deprecated `spawn` command to the CLI, ensuring backward
compatibility and guiding users toward the preferred `create` command.


```
$ e2b sandbox
Usage: index sandbox|sbx [options] [command]

work with sandboxes

Options:
  -h, --help                        display help for command

Commands:
  connect|cn <sandboxID>            connect terminal to already running sandbox
  list|ls [options]                 list all sandboxes, by default it list only running ones
  kill|kl [options] [sandboxID]     kill sandbox
  create|cr [options] [template]    create sandbox and connect terminal to it
  logs|lg [options] <sandboxID>     show logs for sandbox
  metrics|mt [options] <sandboxID>  show metrics for sandbox
  help [command]                    display help for command
  ```
  
  ```
$ sbx sp base
Warning: The 'spawn' command is deprecated and will be removed in future releases. Please use 'e2b sandbox create' instead.
Terminal connecting to template base with sandbox ID in897x2dqs7aws8h1x0in
```
@e2b/cli@2.0.2
2025-09-01 07:44:10 +00:00
Jakub Novák b42ab2a86b Add pipeline for linting and formatting (#883)
Setup linting and formatting in all packages
2025-08-31 12:06:00 -07:00
Jakub Novák a5f4802ec5 Add migration guide to docs (#870)
Adds migration guide for SDK v2
Adds mentions about auto pause

https://e2b-web-git-migration-guide-v2.e2b-preview.dev/docs/migration/v2

---------

Co-authored-by: Vasek Mlejnsky <vasek@e2b.dev>
2025-08-28 01:21:43 -07:00
Mish Ushakov 8743907edb Update pnpm github action to v4 (#874)
Co-authored-by: Jakub Novak <jakub@e2b.dev>
2025-08-25 11:45:23 -07:00
Mish Ushakov abebb40d2a Update github actions to node v20 (#872)
We were using EOL version of Node.js in our GitHub Actions
https://endoflife.date/nodejs

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-08-25 07:21:20 -07:00
github-actions[bot] 663d832ddc [skip ci] Release new versions 2025-08-22 09:45:46 +00:00
Jakub Novák c2195d832f Fix API key check in JS SDK & remove deprecated fields (#869)
Fix the check and remove deprecated fields
@e2b/cli@2.0.1
2025-08-22 09:42:49 +00:00
github-actions[bot] 4eb3a2d322 [skip ci] Release new versions 2025-08-21 20:08:42 +00:00
Jakub Novák fe214af0ce Change envd access token to protected (#867) e2b@2.0.1 2025-08-21 19:56:11 +00:00
Jakub Novák 400bb86e41 Fix docs build (#866)
```
Type error: Property 'some' does not exist on type 'SandboxPaginator'.
  10 | export async function verifySandbox(apiKey: string, sandboxId: string) {
  11 |   const sandboxes = await Sandbox.list({ apiKey })
> 12 |   return sandboxes.some((sandbox) => sandbox.sandboxId === sandboxId)
     |                    ^
  13 | }
  ```
2025-08-21 09:39:54 -07:00
github-actions[bot] 774dfd7667 [skip ci] Release new versions 2025-08-21 15:51:16 +00:00
Jakub Novák 74457ff1dd SDK v2 - Changeset and docs (#862)
SDK v2 release
@e2b/cli@2.0.0 @e2b/python-sdk@2.0.0 e2b@2.0.0
2025-08-21 08:45:25 -07:00
Jakub Novák d117ba09e8 SDK v2 - Add beta pause and update Sandbox list (#854)
Introduce beta submodule with beta features - pause and resume
Update Sandbox list to also return paused sandboxes

---------

Co-authored-by: Tomas Valenta <valenta.and.thomas@gmail.com>
2025-08-19 00:37:07 -07:00
Alessio Fanelli 1fbad37d1b Fix wrong import (#859)
It's Sandbox, not sandbox
2025-08-19 00:25:47 -07:00
0div a6073cede1 Update sandbox lifecycle docs with REST API (#856)
Add section to sandbox [lifecyle docs](https://e2b.dev/docs/sandbox)
about the new RESTful API.

---------

Co-authored-by: Tg Ft <tgft@Tgs-Mac-mini.local>
2025-08-18 00:09:02 -07:00
Vasek Mlejnsky 6da92a5a67 Fix wrong number in rate limits (#858) 2025-08-17 14:01:39 +00: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 da7c60d2dd Simplify connection config handling in Python SDK (#849)
Several improvements and refactors to the Python SDK's sandbox
connection and configuration logic.

The main focus is on making header management more flexible, improving
API parameter handling, and simplifying class structures for better
maintainability and usability.

Also unifies doc strings
2025-08-10 08:09:45 -07:00
Jiri Sveceny 22df213ffb BYOC Docs page (#853)
Added doc page related to the Bring Your Own Cloud offering.
2025-08-07 17:13:26 -07:00
Jakub Dobry 41d909a4bb Update access token location readme (#852) 2025-08-07 04:23:22 -07:00
github-actions[bot] e140ec3717 [skip ci] Release new versions 2025-08-06 21:14:31 +00:00
Tomas Valenta 1f1c666413 Add RateLimitError to export (#851)
Co-authored-by: Zobeir Hamid <zobeirhamid@berkeley.edu>
e2b@1.13.2
2025-08-06 21:09:23 +00:00
github-actions[bot] 7540839268 [skip ci] Release new versions 2025-08-06 10:32:14 +00:00
Tomas Valenta 0bace983b1 Increase default request timeout (#847)
Increase the default request timeout to 60 seconds. This is the value in
the current beta, and with the merge, we want to keep it that way, to
minimize possible negative migration impact.
@e2b/python-sdk@1.11.1 e2b@1.13.1
2025-08-06 03:27:19 -07:00
Tomas Valenta 33b9467bef Allow more protobuf versions (#846)
- Allow protobuf `4.21.0`+ (we previously allowed this, and some users
in beta require this)
- Allow protobuf `6.0.0`+ (some other users need to use the SDK with the
latest versions)

The SDK should work with both of these, but we may want to smoke test it
somehow.

---------

Co-authored-by: Jakub Novak <jakub@e2b.dev>
2025-08-06 03:27:00 -07:00
github-actions[bot] 9d2b3c92a7 [skip ci] Release new versions 2025-08-04 12:40:16 +00:00
Jiri Sveceny c0a41722e5 Secured sandbox auto signature (#845)
Some users report that JS/Python types lack a `useSignature` attribute,
which only works when `secure=true` is set for the sandbox. This change
removes the `useSignatrue` parameter and makes all upload/download URL
requests signed if `secure` was provided, making sure the function will
work for all possible cases.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ben Fornefeld <50748440+ben-fornefeld@users.noreply.github.com>
@e2b/python-sdk@1.11.0 e2b@1.13.0
2025-08-04 12:34:59 +00:00
Vasek Mlejnsky beb1e2cdd8 Fix typo (#844) 2025-08-02 17:23:31 +00:00
Vasek Mlejnsky 2c3b01b3cb Add rate limits page (#843)
Adds page with details about rate limits.

---------

Co-authored-by: Tomas Valenta <valenta.and.thomas@gmail.com>
2025-08-02 01:14:08 +00:00
Vasek Mlejnsky f717caa631 Udate readme assets (#840)
Update images
2025-07-31 14:03:28 -07:00
0div 4d7eda4f51 Sort SDK version for dropdown using semver package (#839)
Sorting the versions lexicographically was not ordering by latest
correctly, now using `semver` package to sort them:
```ts
> versions = [
  '1.9.0',  '1.8.0',
  '1.7.0',  '1.6.0',
  '1.5.0',  '1.4.0',
  '1.3.0',  '1.2.0',
  '1.12.0', '1.11.0',
  '1.10.0', '1.1.0',
  '1.0.0'
]

> versions.sort((a, b) => semver.rcompare(a, b))
[
  '1.12.0', '1.11.0',
  '1.10.0', '1.9.0',
  '1.8.0',  '1.7.0',
  '1.6.0',  '1.5.0',
  '1.4.0',  '1.3.0',
  '1.2.0',  '1.1.0',
  '1.0.0'
]
```
2025-07-31 14:01:15 -07:00
Tomas Valenta 761f74ebaa Remove new tags from Metrics and Persistence (#838) 2025-07-31 10:33:01 -07:00
github-actions[bot] 64a5d52dd5 [skip ci] Release new versions 2025-07-31 10:43:16 +00:00
Jakub Novák ec1b831018 Fix byte shift in sandbox metrics (#837)
This pull request addresses a bug in the CLI related to incorrect byte
shifting for memory and disk metrics when dealing with sizes greater
than 4 GB.
@e2b/cli@1.9.2
2025-07-31 03:40:27 -07:00
github-actions[bot] 0c6cfed137 [skip ci] Release new versions 2025-07-31 09:57:39 +00:00
Jakub Novák 8c4710cc60 Fix metrics cli missing api key (#836)
# Description
Fixing a missing API key issue for sandbox metrics in the CLI
@e2b/cli@1.9.1
2025-07-31 09:54:44 +00:00
github-actions[bot] 115407cf1e [skip ci] Release new versions 2025-07-31 09:44:55 +00: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.
e2b@1.12.0 @e2b/python-sdk@1.10.0
2025-07-31 02:34:57 -07:00
github-actions[bot] 76d62ed070 [skip ci] Release new versions 2025-07-30 19:25:33 +00:00
Jakub Novák e34d69525f Expose sandbox metrics in SDKs and CLI (#828)
# Description

Expose sandbox metrics in SDKs and CLI


```
e2b sbx mt il98ycmohc6enybi79uf8

Metrics for sandbox il98ycmohc6enybi79uf8:

[2025-07-25 14:05:55Z]  CPU:  8.27% /  2 Cores | Memory:    31 / 484   MiB | Disk:  1445 / 2453  MiB
[2025-07-25 14:06:00Z]  CPU:   0.5% /  2 Cores | Memory:    32 / 484   MiB | Disk:  1445 / 2453  MiB
[2025-07-25 14:06:05Z]  CPU:   0.1% /  2 Cores | Memory:    32 / 484   MiB | Disk:  1445 / 2453  MiB
[2025-07-25 14:06:10Z]  CPU:   0.3% /  2 Cores | Memory:    32 / 484   MiB | Disk:  1445 / 2453  MiB

```

---------

Co-authored-by: Tomas Valenta <valenta.and.thomas@gmail.com>
@e2b/cli@1.9.0 @e2b/python-sdk@1.9.0 e2b@1.11.0
2025-07-30 12:17:30 -07:00