make-e2b-code-execution

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Make E2B Code Execution

Make E2B Code Execution

Use this skill when the user wants code to become a durable tool.
Known E2B module id: the E2B sandbox module is
"module": "e2b:RunE2BSandbox"
with
"version": 0
.
The architecture is:
text
Hermes writes code -> Code folder -> local execution or Make E2B Code Shell -> E2B runtime
If that code needs SaaS data, it must call a Make API shell scenario from
make-api-shell-connection-workflow
. Do not put OAuth secrets, Make API tokens, E2B API keys, refresh tokens, provider passwords, or direct provider SDK auth in generated code.
当用户希望代码成为持久化工具时,使用此Skill。
已知E2B模块ID:E2B沙箱模块为
"module": "e2b:RunE2BSandbox"
,版本为
"version": 0
架构如下:
text
Hermes writes code -> Code folder -> local execution or Make E2B Code Shell -> E2B runtime
如果代码需要SaaS数据,必须从
make-api-shell-connection-workflow
调用Make API shell场景。请勿在生成的代码中放入OAuth密钥、Make API令牌、E2B API密钥、刷新令牌、提供商密码或直接的提供商SDK认证信息。

Storage Rule

存储规则

Store all durable code artifacts below the configured Hermes Code folder:
  • local knowledge store:
    knowledge/hermes/Code/...
  • Google Drive knowledge store:
    /Hermes/Code/...
Use the runtime helper, for example:
python
import make_api_shell as make

make.write_code_artifact(
    "tools/calc.py",
    "print(17 * 23)\\n",
    language="python",
    confirm=True,
)
Do not write durable code files directly with shell redirection,
open(...)
, or
Path.write_text(...)
unless the user explicitly asked for a temporary local scratch file.
将所有持久化代码制品存储在配置好的Hermes Code文件夹下:
  • 本地知识库:
    knowledge/hermes/Code/...
  • Google Drive知识库:
    /Hermes/Code/...
使用运行时助手,例如:
python
import make_api_shell as make

make.write_code_artifact(
    "tools/calc.py",
    "print(17 * 23)\\n",
    language="python",
    confirm=True,
)
除非用户明确要求临时本地临时文件,否则请勿使用shell重定向、
open(...)
Path.write_text(...)
直接写入持久化代码文件。

Execution Modes

执行模式

Plain Code Execution

普通代码执行

Use this for quick, non-hosted code:
  1. Write the code artifact under
    Code/
    .
  2. Run it with the local
    code_execution
    tool.
  3. Write a short run note or output artifact only through the configured Knowledge helper.
适用于快速、非托管的代码:
  1. 将代码制品写入
    Code/
    目录下。
  2. 使用本地
    code_execution
    工具运行它。
  3. 仅通过配置的Knowledge助手编写简短的运行说明或输出制品。

Hosted E2B Code Shell

托管E2B Code Shell

Use this when the code should become a reusable hosted tool:
  1. Write the code artifact under
    Code/
    .
  2. Create or reuse a Make scenario that matches the E2B Code Shell contract.
  3. Run the shell with
    codePath
    ,
    language
    ,
    entrypoint
    ,
    input
    ,
    mode
    , and
    timeoutMs
    .
  4. Treat the E2B shell output as the tool result.
The Make scenario is the control-plane shell. E2B is only the runtime. The agent never receives E2B credentials.
当代码需要成为可重用的托管工具时使用此模式:
  1. 将代码制品写入
    Code/
    目录下。
  2. 创建或复用符合E2B Code Shell协议的Make场景。
  3. 使用
    codePath
    language
    entrypoint
    input
    mode
    timeoutMs
    运行shell。
  4. 将E2B shell的输出视为工具结果。
Make场景是控制平面shell,E2B仅作为运行时。Agent永远不会收到E2B凭证。

Building the shell on the verified
e2b
Make app (verified live)

在已验证的
e2b
Make应用上构建shell(已验证可用)

When no infrastructure runner URL is available, build the E2B Code Shell as an app-action shell on the Make-verified app
e2b
("e2b.dev", beta, major version 0), module
e2b:RunE2BSandbox
:
  • Module mapper fields:
    execLanguage
    (
    python
    /
    javascript
    ),
    inputFormat
    (
    string
    /
    base64
    ),
    dependencies
    (array),
    timeoutSeconds
    (number, required),
    code
    (text, required). Map inputs from the standard shell interface as
    {{2.qs.<field>}}
    .
  • The connection comes from a credential request for
    e2b
    /
    RunE2BSandbox
    . Bind it twice: as legacy
    __IMTCONN__
    (required by the shell verifier) and as the module's declared parameter
    account
    — manifest-2/SDK modules ignore
    __IMTCONN__
    and otherwise run without credentials. In helper environments pass
    connection_parameter="account"
    to
    create_app_action_shell_scenario
    .
  • Patch the scenario interface to the generic shell contract before the first run, then activate the scenario.
  • The module's output field is
    logs
    with shape
    {"stdout": ["..."], "stderr": []}
    — map ReturnData as
    {"data": "{{<moduleId>.logs}}"}
    (
    stdout
    /
    result
    /
    output
    do not exist and silently return null). Use
    return_field="logs"
    in helper environments.
  • Editing the scenario in the Make UI renumbers module ids and rewrites the module parameters (dropping
    __IMTCONN__
    ). After any UI edit, re-read the blueprint, re-bind the connection both ways, and fix the ReturnData reference to the new module id — a stale reference returns
    data: null
    on otherwise successful runs.
  • E2B error fingerprints from the module:
    401: authorization header is missing
    means the module sent no key (connection not bound);
    401: authorization header is malformed
    means the stored apiKey does not start with
    e2b_
    — common causes: a "Bearer " prefix, quotes, the
    sk_e2b_...
    Access Token pasted instead of the API Key, or a UI save that silently did not persist (fix via
    POST /connections/{id}/set-data
    ). The e2b app sends
    X-API-Key: <apiKey>
    raw, so store the bare
    e2b_...
    key.
当没有基础设施运行器URL可用时,在Make已验证的应用
e2b
("e2b.dev",测试版,主版本0)上构建E2B Code Shell作为应用操作shell,模块为
e2b:RunE2BSandbox
  • 模块映射字段:
    execLanguage
    python
    /
    javascript
    )、
    inputFormat
    string
    /
    base64
    )、
    dependencies
    (数组)、
    timeoutSeconds
    (数字,必填)、
    code
    (文本,必填)。将标准shell接口的输入映射为
    {{2.qs.<field>}}
  • 连接来自
    e2b
    /
    RunE2BSandbox
    的凭证请求。绑定两次:作为旧版
    __IMTCONN__
    (shell验证器要求)和模块声明的参数
    account
    ——manifest-2/SDK模块会忽略
    __IMTCONN__
    ,否则将无凭证运行。在助手环境中,向
    create_app_action_shell_scenario
    传递
    connection_parameter="account"
  • 在首次运行前,将场景接口修补为通用shell协议,然后激活场景。
  • 模块的输出字段为**
    logs
    **,格式为
    {"stdout": ["..."], "stderr": []}
    ——将ReturnData映射为
    {"data": "{{<moduleId>.logs}}"}
    stdout
    /
    result
    /
    output
    不存在,会静默返回null)。在助手环境中使用
    return_field="logs"
  • 在Make UI中编辑场景会重新编号模块ID并重写模块参数(丢弃
    __IMTCONN__
    )。任何UI编辑后,重新读取蓝图,双向重新绑定连接,并修复ReturnData对新模块ID的引用——过时的引用会在运行成功时返回
    data: null
  • 模块返回的E2B错误特征:
    401: authorization header is missing
    表示模块未发送密钥(连接未绑定);
    401: authorization header is malformed
    表示存储的apiKey未以
    e2b_
    开头——常见原因:带有"Bearer "前缀、引号、粘贴了
    sk_e2b_...
    访问令牌而非API密钥,或UI保存未静默持久化(通过
    POST /connections/{id}/set-data
    修复)。e2b应用会直接发送
    X-API-Key: <apiKey>
    ,因此请存储纯
    e2b_...
    密钥。

Nested SaaS Access

嵌套SaaS访问

For “inception” tools, generated code may call Make API shell scenarios:
text
Hosted code -> Make Gmail API shell -> Gmail API
The hosted code should receive only scenario IDs, paths, request payloads, and non-secret input data. It must never receive raw Make or provider credentials.
对于“inception”工具,生成的代码可以调用Make API shell场景:
text
Hosted code -> Make Gmail API shell -> Gmail API
托管代码应仅接收场景ID、路径、请求负载和非机密输入数据。绝不能接收原始Make或提供商凭证。

References

参考资料

  • Execution modes
  • E2B Code Shell scenario contract
  • 执行模式
  • E2B Code Shell场景协议