Skip to main content

Install

Requires Python 3.10+.

Configuration

Core verbs

run_code(code, language="python") -> ExecResult

Blocks until the code finishes, returns ExecResult(stdout, stderr, exit_code).

run_code_stream(code, language="python") -> Iterator[Event]

Yields events as they arrive.

fork(n=1) -> list[Sandbox]

See Fork for semantics.

diff(other, paths=None) -> dict

Filesystem diff against another sandbox.

merge_into(winner) -> None

Commit a winner fork as the new state.

upload(data, remote_path) -> None and download(remote_path) -> bytes

Small-file transfer (best for files up to a few MB).

close() / context manager

Framework adapters

OpenAI Agents SDK

from podflare.integrations.openai_agents import podflare_code_interpreter

Anthropic Messages API

from podflare.integrations.anthropic import handle_code_execution_tool_use

Typing

The SDK ships full type annotations. ExecResult, Event, and Language are importable from the top-level module.