@gea-ai/computer-e2b
v0.1.260923-alpha.2
Published
E2B Computer declaration for the GEA Worker native binding
Readme
GEA E2B Computer
The factory selects E2B in developer code. The existing Worker COMPUTER native
binding connects directly to E2B's API and envd. No additional GEA service or Pod
is needed; API keys and envd credentials remain outside Agent JavaScript.
import { defineAgent } from "@gea-ai/agent-sdk";
import { secret } from "@gea-ai/agent-sdk/computer";
import { e2b } from "@gea-ai/computer-e2b";
export default defineAgent({
name: "E2B Agent",
slug: "e2b-agent",
model: "gea-model-1",
computer: e2b({
apiKey: secret("E2B_API_KEY"),
template: "base",
timeoutMs: 300_000,
filesystem: { durability: "ephemeral", files: { "hello.txt": "Hello" } },
async onSession({ use }) {
const computer = await use();
const result = await computer.exec({ command: "python --version" });
if (result.exitCode !== 0) throw new Error("Python is required");
},
}),
});Set the referenced environment secret in Studio or the local CLI environment.
Do not additionally declare that secret in Agent environment unless Agent code
itself needs it. The package contains the declaration; the native implementation
ships with Worker Runtime, and there is no /host entrypoint.
Each invocation gets an ephemeral sandbox. Seeds and read-only Skills precede
onSession. Closing the invocation releases the sandbox; the configured E2B
lifetime bounds cleanup after a crash or network failure. Files do not survive
invocations, Worker restarts or sandbox expiry. Use Artifacts for retained files.
Unknown creation or mutation outcomes are never replayed within an invocation.
The template needs Linux bash, Python 3, coreutils timeout, useradd, and an
unprivileged gea-agent user without passwordless sudo. Skills are root-owned.
Commands have a 120-second deadline and 2 MiB output limit; cancellation terminates
the process group, including descendants. The base template is tested.
The public stream/binary/text and directory methods use the same filesystem as commands. Buffered reads are limited to 16 MiB. Stream writes use four bounded upload slots and at most 10 GiB per file, staging on Worker disk before an envd upload and atomic publication inside the sandbox. No partial destination is published on a failed source. Private staging and destinations must share the same sandbox filesystem; parent resolution rejects symlinks.
Artifact copies use the existing single-file ticket and 8 MiB multipart protocol. Object-store URLs remain native. Downloads are measured and hashed on Worker disk before publication to E2B; uploads read envd streams and check source identity before completing the Artifact. No independent transfer service or directory synchronization is introduced.
From this repository, set E2B_API_KEY in the test process and run:
pnpm --dir packages/computer-e2b test:liveThis opt-in test creates a paid sandbox and verifies creation, seeds, 20 MiB binary I/O, read-only Skills, mutation receipts, descendant cancellation and confirmed deletion. It is excluded from the default test suite. Other templates, npm publication and production deployment remain separate verification steps.
See E2B lifecycle documentation and the public Agent development guide.
