Skip to content

feat(sdk): add shell option to commands.run - #2138

Merged
mishushakov merged 4 commits into
mainfrom
devin/1794582514-commands-shell
Nov 13, 2026
Merged

mishushakov merged 4 commits into
mainfrom
devin/1794582514-commands-shell

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a shell option to commands.run (JS, Python sync + async) to run the command with a custom executable and arguments. The command is appended as the last argument; the default is unchanged (/bin/bash -l -c <cmd>).

process: { cmd: shell[0], args: [...shell.slice(1), cmd] }   // shell ?? ['/bin/bash', '-l', '-c']

An empty shell (or empty executable) throws InvalidArgumentError / InvalidArgumentException. In Python, shell is keyword-only (next to retain_output); the split lives in e2b.sandbox.commands.main.shell_command, shared by sync and async.

await sandbox.commands.run('print(6 * 7)', { shell: ['python3', '-c'] }) // stdout: "42\n"
await sandbox.commands.run('echo $0', { shell: ['/bin/sh', '-c'] })      // stdout: "/bin/sh\n"
sandbox.commands.run("print(6 * 7)", shell=["python3", "-c"])
await async_sandbox.commands.run("echo $0", shell=["/bin/sh", "-c"])

Docs: https://github.com/e2b-dev/docs/pull/652

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

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@cla-bot cla-bot Bot added the cla-signed label Nov 13, 2026
@changeset-bot

changeset-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7cca0d3

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

This PR includes changesets to release 3 packages
Name Type
e2b Minor
@e2b/python-sdk Minor
@e2b/code-interpreter-python Patch

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 Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 6acf02a. Download artifacts from this workflow run.

JS SDK (e2b@2.63.1-devin-1794582514-commands-shell.0, with @e2b/dockerfile-utils@0.1.2-devin-1794582514-commands-shell.0):

npm install ./e2b-dockerfile-utils-0.1.2-devin-1794582514-commands-shell.0.tgz ./e2b-2.63.1-devin-1794582514-commands-shell.0.tgz

CLI (@e2b/cli@2.23.1-devin-1794582514-commands-shell.0):

npm install ./e2b-cli-2.23.1-devin-1794582514-commands-shell.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.9.2-devin-1794582514-commands-shell.0):

npm install ./e2b-code-interpreter-2.9.2-devin-1794582514-commands-shell.0.tgz

Desktop JS SDK (@e2b/desktop@2.5.1-devin-1794582514-commands-shell.0):

npm install ./e2b-desktop-2.5.1-devin-1794582514-commands-shell.0.tgz

Python SDK (e2b==2.63.0+devin.1794582514.commands.shell, with e2b-dockerfile-utils==0.1.1+devin.1794582514.commands.shell):

pip install ./e2b_dockerfile_utils-0.1.1+devin.1794582514.commands.shell-py3-none-any.whl ./e2b-2.63.0+devin.1794582514.commands.shell-py3-none-any.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.11.9+devin.1794582514.commands.shell):

pip install ./e2b_code_interpreter-2.11.9+devin.1794582514.commands.shell-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.7.2+devin.1794582514.commands.shell):

pip install ./e2b_desktop-2.7.2+devin.1794582514.commands.shell-py3-none-any.whl

devin-ai-integration[bot]

This comment was marked as resolved.

@mishushakov
mishushakov marked this pull request as ready for review November 13, 2026 15:11
@mishushakov
mishushakov self-requested a review as a code owner November 13, 2026 15:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T15:13:56.501044Z b5a04ab Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I reviewed this PR and found no new bugs. It adds a new option to the public commands.run API in all three SDKs, so a maintainer should still look at the API design.

What was reviewed:

  • The JS Commands.run path. The shell option is split into cmd and args, the default is still /bin/bash -l -c, and an empty or missing executable throws InvalidArgumentError before the RPC is sent.
  • The Python helper shell_command and how the sync and async run and _start methods pass shell through. Both build the same ProcessConfig, and shell is keyword-only in every overload.
  • The changeset is a minor bump for both packages. The new tests cover a custom shell, a shell with no arguments and an empty shell list in all three SDKs.
Extended reasoning...

The change adds an optional shell list to commands.run in the JS SDK and in the sync and async Python SDKs. It replaces the hardcoded /bin/bash -l -c with shell[0] plus the remaining arguments and the command. The default behavior is unchanged. Validation and error types match across the SDKs, and integration tests cover the new paths. The change is small but adds to the public API of both published packages.

devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
@mishushakov
mishushakov merged commit 1b3b2a4 into main Nov 13, 2026
39 checks passed
@mishushakov
mishushakov deleted the devin/1794582514-commands-shell branch November 13, 2026 15:46
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