Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to E2B

Scalekit connector
Open markdown

The E2B connector lets your AI agent act in each user's E2B account. Each user connects their own E2B API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 38 tools.

Tools
38
What they doRead · write · destructive
20 · 13 · 520 read13 write5 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the E2B connection

    In AgentKit > Connections, create an E2B connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'e2b'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize E2B:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'e2b_list_events',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their E2B credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • e2b_get_sandboxGet one E2B sandbox by its ID.Read-only

    Get Sandbox

    Get one E2B sandbox by its ID. Returns sandboxID, templateID, alias, state, startedAt, endAt, cpuCount, memoryMB, diskSizeMB, metadata, envdVersion, envdAccessToken, domain, allowInternetAccess, network, lifecycle (autoResume and onTimeout) and volumeMounts. Use this for a single sandbox's details. Use e2b_list_sandboxes to find sandbox IDs.

    Inputs

    sandbox_idstringrequired
    ID of the sandbox to get, as returned by e2b_create_sandbox or e2b_list_sandboxes (sandboxID). Example: iiny0783cype8gmoawzmx
  • e2b_get_sandbox_logsGet the logs of an E2B sandbox, optionally filtered by level or text.Read-only

    Get Sandbox Logs

    Get the logs of an E2B sandbox, optionally filtered by level or text. Returns logs, an array of entries with timestamp, level, message and fields. Use this to debug what happened in a sandbox. Use e2b_list_sandbox_events for lifecycle events such as created or killed.

    Inputs

    sandbox_idstringrequired
    ID of the sandbox to get logs for, as returned by e2b_create_sandbox or e2b_list_sandboxes (sandboxID). Example: iiny0783cype8gmoawzmx
    cursorinteger
    Timestamp in Unix milliseconds to start returning logs from. Example: 1760486400000
    directionstring
    Read direction from the cursor: forward (newer) or backward (older).one of forwardbackward
    levelstring
    Minimum log level to return, such as info, warn or error; lower levels are left out. Example: warn
    limitinteger
    Maximum number of log entries to return, from 0 to 1000. Defaults to 1000. Example: 200default 1000
    searchstring
    Case-sensitive text that the log message must contain. Example: Traceback
  • e2b_get_sandbox_metricsGet resource usage metrics over time for one E2B sandbox.Read-only

    Get Sandbox Metrics

    Get resource usage metrics over time for one E2B sandbox. Returns an array of samples with timestampUnix, cpuCount, cpuUsedPct, memUsed, memTotal, memCache, diskUsed and diskTotal (bytes). Use this for one sandbox's usage history. Use e2b_list_sandbox_metrics for the latest sample of several sandboxes at once.

    Inputs

    sandbox_idstringrequired
    ID of the sandbox to get metrics for, as returned by e2b_create_sandbox or e2b_list_sandboxes (sandboxID). Example: iiny0783cype8gmoawzmx
    endinteger
    End of the time interval as a Unix timestamp in seconds. Leave empty to use E2B's default window. Example: 1760490000
    startinteger
    Start of the time interval as a Unix timestamp in seconds. Leave empty to use E2B's default window. Example: 1760486400
  • e2b_get_secretGet one E2B secret's metadata by its ID or name.Read-only

    Get Secret

    Get one E2B secret's metadata by its ID or name. Returns secretID, name, currentVersion, metadata, createdAt and updatedAt; the secret value is never returned. Use this to check a secret exists and see its current version. Use e2b_list_secrets to browse.

    Inputs

    secret_idstringrequired
    The secret to get: its ID (sec_...) or its name. Example: stripe_api_key
  • e2b_get_team_max_metricGet the peak value of one E2B team metric in a time window.Read-only

    Get Team Max Metric

    Get the peak value of one E2B team metric in a time window. Returns timestampUnix and value of the maximum. Use this to check peak concurrency or start rate against plan limits. Use e2b_get_team_metrics for the full time series.

    Inputs

    metricstringrequired
    Metric to get the maximum of: concurrent_sandboxes or sandbox_start_rate.one of concurrent_sandboxessandbox_start_rate
    team_idstringrequired
    Your team identifier, as its UUID or its public project ID (prj_...), shown in the E2B console. Example: prj_8f3k2l9q
    endinteger
    End of the time interval as a Unix timestamp in seconds. Leave empty to use E2B's default window. Example: 1760490000
    startinteger
    Start of the time interval as a Unix timestamp in seconds. Leave empty to use E2B's default window. Example: 1760486400
  • e2b_get_team_metricsGet your E2B team's sandbox usage over time.Read-only

    Get Team Metrics

    Get your E2B team's sandbox usage over time. Returns an array of samples with timestampUnix, concurrentSandboxes and sandboxStartRate. Use this to chart concurrency and start rate. Use e2b_get_team_max_metric for the peak value in a window.

    Inputs

    team_idstringrequired
    Your team identifier, as its UUID or its public project ID (prj_...), shown in the E2B console. Example: prj_8f3k2l9q
    endinteger
    End of the time interval as a Unix timestamp in seconds. Leave empty to use E2B's default window. Example: 1760490000
    startinteger
    Start of the time interval as a Unix timestamp in seconds. Leave empty to use E2B's default window. Example: 1760486400
  • e2b_get_templateGet one E2B template and its builds.Read-only

    Get Template

    Get one E2B template and its builds. Returns templateID, names, aliases, public, createdAt, updatedAt, lastSpawnedAt, spawnCount and builds (each with buildID, status, cpuCount, memoryMB, diskSizeMB, envdVersion, createdAt and finishedAt). The cursor for more builds is in the X-Next-Token response header. Use this to see a template's build history and get a buildID. Use e2b_list_templates to find template IDs.

    Inputs

    template_idstringrequired
    ID of the template to get, as returned by e2b_list_templates (templateID). Example: rki5dems9wqfm4r03t7g
    limitinteger
    Maximum number of builds to return per page, from 1 to 100. Defaults to 100. Example: 50default 100
    next_tokenstring
    Pagination cursor. Pass the value of the X-Next-Token response header from the previous page to get the next page; leave empty for the first page.
  • e2b_get_template_build_logsGet the logs of an E2B template build, paged by time.Read-only

    Get Template Build Logs

    Get the logs of an E2B template build, paged by time. Returns logs, an array of entries with timestamp, level, message and step. Use this to read a long build log. Use e2b_get_template_build_status to check whether the build succeeded.

    Inputs

    build_idstringrequired
    ID of the template build, from the builds list in e2b_get_template (buildID). Example: a979a14b-bdcc-49e6-bc04-1189fc9fe7c2
    template_idstringrequired
    ID of the template to read logs for, as returned by e2b_list_templates (templateID). Example: rki5dems9wqfm4r03t7g
    cursorinteger
    Timestamp in Unix milliseconds to start returning logs from. Example: 1760486400000
    directionstring
    Read direction from the cursor: forward (newer) or backward (older).one of forwardbackward
    levelstring
    Minimum log level to return, such as info, warn or error. Example: warn
    limitinteger
    Maximum number of log entries to return, from 0 to 100. Defaults to 100. Example: 50default 100
    sourcestring
    Where to read logs from: temporary (live build logs) or persistent (stored logs).one of temporarypersistent