Supported Languages

Updated at:

E2B Code Interpreter runs Python by default. FC Agent Sandbox currently supports JavaScript, TypeScript, and Bash through the language parameter. Java and R are not supported.

Python

Python is the default language, so you do not need to pass language explicitly:

execution = sandbox.run_code('print("Hello, world!")')
print("".join(execution.logs.stdout or []).strip())

TypeScript example:

const execution = await sandbox.runCode('print("Hello, world!")');
console.log(execution.logs.stdout.join("").trim());

JavaScript and TypeScript

Use javascript or js for JavaScript, and typescript or ts for TypeScript:

context = sandbox.create_code_context(
  cwd="/home/user",
  language="typescript",
  request_timeout=60_000,
)
execution = sandbox.run_code(
  """
const value = await Promise.resolve(42)
console.log(value)
""",
  context=context,
)

In the TypeScript SDK, use the same language option:

const execution = await sandbox.runCode(
  `
const value = await Promise.resolve(42)
console.log(value)
`,
  { context: { language: "typescript" } },
);

The official E2B documentation states that TypeScript supports top-level await, ESM-style imports, and automatic Promise resolution. When you integrate with FC Agent Sandbox, verify the Node.js version and dependency installation path inside the template first.

Bash

Use the corresponding language value for other languages:

sandbox.run_code('echo "Hello from Bash"', language="bash")

TypeScript example:

await sandbox.runCode('echo "Hello from Bash"', { language: "bash" });

Selection guidance

  • Prefer Python for data analysis and chart generation.

  • Use JavaScript or TypeScript when you need npm packages, ESM imports, or TypeScript syntax, and install dependencies first.

  • Prefer the Commands API for simple system commands. Use language="bash" only when you need to preserve execution state inside the Code Interpreter context.

  • For Java code, use the Commands API to run javac and java inside a template that includes the Java runtime.

  • For R code, use the Commands API to run Rscript inside a template that includes the R runtime.

  • Before production rollout, prepare a minimal validation script for each language and confirm that stdout, stderr, execution.results, and error returns behave as expected.