Skip to content

feat(sdk): add an E2B client to the Desktop SDKs - #1784

Draft
devin-ai-integration[bot] wants to merge 2 commits into
devin/1787774000-code-interpreter-e2b-clientfrom
devin/1787774001-desktop-e2b-client
Draft

feat(sdk): add an E2B client to the Desktop SDKs#1784
devin-ai-integration[bot] wants to merge 2 commits into
devin/1787774000-code-interpreter-e2b-clientfrom
devin/1787774001-desktop-e2b-client

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Same change as #1783 (which this is stacked on), for @e2b/desktop and e2b-desktop: an E2B client that binds the connection configuration explicitly instead of reading it from the environment. packages/js-sdk and packages/python-sdk are untouched — the binding is local to the package and only uses the existing ClientFactory class state (boundOpts / _bound_api_params) the Desktop Sandbox already inherits.

import { E2B } from '@e2b/desktop'

const desktop = await new E2B({ apiKey, domain }).Sandbox.create()
await desktop.stream.start()
from e2b_desktop import E2B

desktop = E2B(api_key=..., domain=...).Sandbox.create()
desktop.stream.start()
// src/client.ts — Desktop Sandbox bound locally…
this.Sandbox = class extends Sandbox {
  protected static override readonly boundOpts = boundOpts
}
// …the rest delegated to the core client.
const core = new CoreE2B(boundOpts)
this.Volume = core.Volume
this.Template = core.Template
this.Secret = core.Secret

Python mirrors it with the local _bind(cls, api_params) helper. Options are copied (nested header maps snapshotted, signal dropped), precedence stays per-call > client > env, undefined/None doesn't clear a bound value, and clients stay isolated from each other and from the top-level exports.

The new JS suite mocks the API with a local node:http server, so it's excluded from the workerd leg (Node/bun/deno keep running it); desktop.startStream-style calls into envd are stubbed since only the API calls carry the bound config.

Link to Devin session: https://app.devin.ai/sessions/ec1af68649fd4880a1cb27cb51d819e9
Open in Devin Desktop: https://app.devin.ai/desktop/session/ec1af68649fd4880a1cb27cb51d819e9?variant=devin
Requested by: @mishushakov

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@cla-bot cla-bot Bot added the cla-signed label Aug 27, 2026
@changeset-bot

changeset-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 95025df

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@e2b/desktop Minor
@e2b/desktop-python Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 97d0c3c. Download artifacts from this workflow run.

JS SDK (e2b@2.46.2-devin-1787774001-desktop-e2b-client.0):

npm install ./e2b-2.46.2-devin-1787774001-desktop-e2b-client.0.tgz

CLI (@e2b/cli@2.18.1-devin-1787774001-desktop-e2b-client.0):

npm install ./e2b-cli-2.18.1-devin-1787774001-desktop-e2b-client.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.7.3-devin-1787774001-desktop-e2b-client.0):

npm install ./e2b-code-interpreter-2.7.3-devin-1787774001-desktop-e2b-client.0.tgz

Desktop JS SDK (@e2b/desktop@2.3.4-devin-1787774001-desktop-e2b-client.0):

npm install ./e2b-desktop-2.3.4-devin-1787774001-desktop-e2b-client.0.tgz

Python SDK (e2b==2.46.1+devin.1787774001.desktop.e2b.client):

pip install ./e2b-2.46.1+devin.1787774001.desktop.e2b.client-py3-none-any.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.9.2+devin.1787774001.desktop.e2b.client):

pip install ./e2b_code_interpreter-2.9.2+devin.1787774001.desktop.e2b.client-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.4.4+devin.1787774001.desktop.e2b.client):

pip install ./e2b_desktop-2.4.4+devin.1787774001.desktop.e2b.client-py3-none-any.whl

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TASTE.md review

Checked the diff against the SDK design principles in TASTE.md, with emphasis on the rules this change can plausibly break: cross-language parity (T-1, T-2), option-type naming and shape (T-10, T-22, T-23), JS data-vs-class and export hygiene (T-19, T-54), config resolution (T-49, T-51), and docstrings (T-69–T-72).

Overall the desktop client is a faithful mirror of the Code Interpreter client from the base PR: options are copied rather than aliased (T-51), the whole connection surface is bound rather than a { apiKey, domain } subset (T-6), signal is deliberately excluded from the bound options (T-46), and both classes and their members carry real JSDoc/docstrings with examples (T-69, T-70).

2 violations, both inline.

Not tied to a specific changed line:

  • packages/desktop-python/pyproject.toml raises the floor to e2b>=2.46.1, but ClientFactory._with_params — the API this client is built on — is added by the base PR and is not in 2.46.1. The floor should be the first release that actually ships it, otherwise a user resolving to 2.46.1 gets an AttributeError at E2B(...) construction time.
  • packages/desktop-python/e2b_desktop/__init__.py computes __all__ from e2b.__all__ at import time. It satisfies T-54 at runtime, but the public surface is no longer greppable in the file — worth a comment pointing at the core __all__ if this pattern stays.

@@ -1,3 +1,4 @@
export * from 'e2b'

export { E2B, type E2BClientOpts } from './client'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T-54 — one flat entry point per package, and in JS "runtime values use export and type-only names use export type — never mixed". This line mixes the runtime class E2B with the type-only E2BClientOpts in a single export statement; split them so the type-only name goes through export type:

Suggested change
export { E2B, type E2BClientOpts } from './client'
export { E2B } from './client'
export type { E2BClientOpts } from './client'

from e2b_desktop.main import Sandbox


class E2BClientParams(ApiParams, total=False):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T-22 / T-1 — "Option types use the Opts suffix in both languages", and the JS and Python surfaces "mirror each other 1:1 in names", differing only by language idiom (camelCasesnake_case, T-1a). OptsParams is not a language idiom, so the exported option type here should be E2BClientOpts, matching packages/desktop-js/src/client.ts:

class E2BClientOpts(ApiParams, total=False):
    """Options bound to an :class:`E2B` client, ..."""

No suggestion block since the rename also touches the E2BClientParams re-export in e2b_desktop/__init__.py (and the same name is introduced for the core and Code Interpreter clients in the base PR) — worth settling in the base PR and mirroring here, so the three packages don't ship two spellings of the same type.

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1787774001-desktop-e2b-client branch from 47fd4c1 to 5632182 Compare August 27, 2026 21:23
devin-ai-integration Bot and others added 2 commits August 27, 2026 21:33
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
…ntouched

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1787774001-desktop-e2b-client branch from 5632182 to 95025df Compare August 27, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant