## API Report File for "@e2b/sdk"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import * as fetcher from 'openapi-typescript-fetch';
import { OpArgType } from 'openapi-typescript-fetch';
import * as openapi_typescript_fetch_dist_cjs_types from 'openapi-typescript-fetch/dist/cjs/types';
import { Run } from 'openai/resources/beta/threads/runs/runs';
import { RunSubmitToolOutputsParams } from 'openai/resources/beta/threads/runs/runs';
import { TypedFetch } from 'openapi-typescript-fetch';

// @public (undocumented)
export interface Action<S extends Sandbox = Sandbox, T = {
    [key: string]: any;
}> {
    // (undocumented)
    (sandbox: S, args: T): string | Promise<string>;
}

// @public (undocumented)
export const api: {
    configure: (config: openapi_typescript_fetch_dist_cjs_types.FetchConfig) => void;
    use: (mw: fetcher.Middleware) => number;
    path: <P extends keyof paths>(path: P) => {
        method: <M extends keyof paths[P]>(method: M) => {
            create: openapi_typescript_fetch_dist_cjs_types.CreateFetch<M, paths[P][M]>;
        };
    };
};

// @public (undocumented)
export const API_HOST: string;

// @public (undocumented)
export class Artifact<S extends DataAnalysis> {
    constructor(path: string, sandbox: S);
    // (undocumented)
    readonly path: string;
    // (undocumented)
    readonly _sandbox: S;
}

// @public (undocumented)
export type ClientType = typeof api;

// @public (undocumented)
export enum CodeRuntime {
    // (undocumented)
    Bash = "Bash",
    // (undocumented)
    Node16 = "Node16",
    // (undocumented)
    Python3 = "Python3",
    // (undocumented)
    Python3_DataAnalysis = "Python3-DataAnalysis"
}

// @public (undocumented)
export interface components {
    // (undocumented)
    parameters: {
        envID: string;
        buildID: string;
        instanceID: string;
    };
    // (undocumented)
    responses: {
        400: {
            content: {
                "application/json": components["schemas"]["Error"];
            };
        };
        401: {
            content: {
                "application/json": components["schemas"]["Error"];
            };
        };
        404: {
            content: {
                "application/json": components["schemas"]["Error"];
            };
        };
        500: {
            content: {
                "application/json": components["schemas"]["Error"];
            };
        };
    };
    // (undocumented)
    schemas: {
        NewInstance: {
            envID: string;
        };
        Environment: {
            envID: string;
            buildID: string;
            public: boolean;
            aliases?: string[];
        };
        EnvironmentBuild: {
            logs: string[];
            envID: string;
            buildID: string;
            status?: "building" | "ready" | "error";
        } & {
            finished: unknown;
        };
        Instance: {
            envID: string;
            instanceID: string;
            clientID: string;
        };
        Error: {
            code: number;
            message: string;
        };
    };
}

// @public (undocumented)
class DataAnalysis extends Sandbox {
    constructor(opts: Omit<SandboxOpts, 'template'>);
    // (undocumented)
    static create(): Promise<DataAnalysis>;
    // (undocumented)
    static create(opts: Omit<SandboxOpts, 'template'>): Promise<DataAnalysis>;
    // (undocumented)
    installPythonPackages(packageNames: string | string[]): Promise<void>;
    // (undocumented)
    installSystemPackages(packageNames: string | string[]): Promise<void>;
    // (undocumented)
    runPython(code: string, opts?: RunPythonOpts<this>): Promise<{
        stdout: string;
        stderr: string;
        artifacts: Artifact<DataAnalysis>[];
    }>;
}
export { DataAnalysis as CodeInterpreter }
export { DataAnalysis }

// @public (undocumented)
export type DownloadFileFormat = 'base64' | 'blob' | 'buffer' | 'arraybuffer' | 'text';

// @public (undocumented)
export type EnvVars = {
    [key: string]: string;
};

// @public (undocumented)
export interface FileInfo {
    // (undocumented)
    isDir: boolean;
    // (undocumented)
    name: string;
}

// @public (undocumented)
export interface FilesystemEvent {
    // (undocumented)
    isDir: boolean;
    // (undocumented)
    name: string;
    // (undocumented)
    operation: FilesystemOperation;
    // (undocumented)
    path: string;
    // (undocumented)
    timestamp: number;
}

// @public (undocumented)
export type FilesystemEventListener = (event: FilesystemEvent) => Promise<void> | void;

// @public
export interface FilesystemManager {
    list(path: string, opts?: CallOpts): Promise<FileInfo[]>;
    makeDir(path: string, opts?: CallOpts): Promise<void>;
    read(path: string, opts?: CallOpts): Promise<string>;
    readBytes(path: string): Promise<Uint8Array>;
    remove(path: string, opts?: CallOpts): Promise<void>;
    watchDir(path: string): FilesystemWatcher;
    // Warning: (ae-forgotten-export) The symbol "CallOpts" needs to be exported by the entry point index.d.ts
    write(path: string, content: string, opts?: CallOpts): Promise<void>;
    writeBytes(path: string, content: Uint8Array): Promise<void>;
}

// @public (undocumented)
export enum FilesystemOperation {
    // (undocumented)
    Chmod = "Chmod",
    // (undocumented)
    Create = "Create",
    // (undocumented)
    Remove = "Remove",
    // (undocumented)
    Rename = "Rename",
    // (undocumented)
    Write = "Write"
}

// @public (undocumented)
export class FilesystemWatcher {
    // Warning: (ae-forgotten-export) The symbol "SandboxConnection" needs to be exported by the entry point index.d.ts
    constructor(sessConn: SandboxConnection, path: string);
    // (undocumented)
    addEventListener(l: FilesystemEventListener): () => boolean;
    // (undocumented)
    start(opts?: CallOpts): Promise<void>;
    // (undocumented)
    stop(): Promise<void>;
}

// @public (undocumented)
export interface OpenPort {
    // (undocumented)
    ip: string;
    // (undocumented)
    port: number;
    // (undocumented)
    state: string;
}

// @public
export interface paths {
    // (undocumented)
    "/envs": {
        get: {
            responses: {
                200: {
                    content: {
                        "application/json": components["schemas"]["Environment"][];
                    };
                };
                401: components["responses"]["401"];
                500: components["responses"]["500"];
            };
        };
        post: {
            responses: {
                202: {
                    content: {
                        "application/json": components["schemas"]["Environment"];
                    };
                };
                401: components["responses"]["401"];
                500: components["responses"]["500"];
            };
            requestBody: {
                content: {
                    "multipart/form-data": {
                        alias?: string;
                        buildContext: string;
                        dockerfile: string;
                        startCmd?: string;
                    };
                };
            };
        };
    };
    // (undocumented)
    "/envs/{envID}": {
        post: {
            parameters: {
                path: {
                    envID: components["parameters"]["envID"];
                };
            };
            responses: {
                202: {
                    content: {
                        "application/json": components["schemas"]["Environment"];
                    };
                };
                401: components["responses"]["401"];
                500: components["responses"]["500"];
            };
            requestBody: {
                content: {
                    "multipart/form-data": {
                        alias?: string;
                        buildContext: string;
                        dockerfile: string;
                        startCmd?: string;
                    };
                };
            };
        };
        delete: {
            parameters: {
                path: {
                    envID: components["parameters"]["envID"];
                };
            };
            responses: {
                204: never;
                401: components["responses"]["401"];
                500: components["responses"]["500"];
            };
        };
    };
    // (undocumented)
    "/envs/{envID}/builds/{buildID}": {
        get: {
            parameters: {
                path: {
                    envID: components["parameters"]["envID"];
                    buildID: components["parameters"]["buildID"];
                };
                query: {
                    logsOffset?: number;
                };
            };
            responses: {
                200: {
                    content: {
                        "application/json": components["schemas"]["EnvironmentBuild"];
                    };
                };
                401: components["responses"]["401"];
                404: components["responses"]["404"];
                500: components["responses"]["500"];
            };
        };
    };
    // (undocumented)
    "/envs/{envID}/builds/{buildID}/logs": {
        post: {
            parameters: {
                path: {
                    envID: components["parameters"]["envID"];
                    buildID: components["parameters"]["buildID"];
                };
            };
            responses: {
                201: unknown;
                401: components["responses"]["401"];
                404: components["responses"]["404"];
            };
            requestBody: {
                content: {
                    "application/json": {
                        apiSecret: string;
                        logs: string[];
                    };
                };
            };
        };
    };
    // (undocumented)
    "/health": {
        get: {
            responses: {
                200: unknown;
                401: components["responses"]["401"];
            };
        };
    };
    // (undocumented)
    "/instances": {
        post: {
            responses: {
                201: {
                    content: {
                        "application/json": components["schemas"]["Instance"];
                    };
                };
                400: components["responses"]["400"];
                401: components["responses"]["401"];
                500: components["responses"]["500"];
            };
            requestBody: {
                content: {
                    "application/json": components["schemas"]["NewInstance"];
                };
            };
        };
    };
    // (undocumented)
    "/instances/{instanceID}/refreshes": {
        post: {
            parameters: {
                path: {
                    instanceID: components["parameters"]["instanceID"];
                };
            };
            responses: {
                204: never;
                401: components["responses"]["401"];
                404: components["responses"]["404"];
            };
            requestBody: {
                content: {
                    "application/json": {
                        duration?: number;
                    };
                };
            };
        };
    };
}

// @public
export class Process {
    constructor(processID: string, sandbox: SandboxConnection, triggerExit: () => void, finished: Promise<ProcessOutput>, output: ProcessOutput);
    // @deprecated (undocumented)
    readonly finished: Promise<ProcessOutput>;
    kill(): Promise<void>;
    // (undocumented)
    readonly output: ProcessOutput;
    // (undocumented)
    readonly processID: string;
    sendStdin(data: string, opts?: CallOpts): Promise<void>;
    wait(): Promise<ProcessOutput>;
}

// @public
export interface ProcessManager {
    start(cmd: string): Promise<Process>;
    // Warning: (ae-forgotten-export) The symbol "ProcessOpts" needs to be exported by the entry point index.d.ts
    start(opts: ProcessOpts): Promise<Process>;
    startAndWait(cmd: string): Promise<ProcessOutput>;
    startAndWait(opts: ProcessOpts): Promise<ProcessOutput>;
}

// @public
export class ProcessMessage {
    constructor(line: string,
    timestamp: number, error: boolean);
    // (undocumented)
    readonly error: boolean;
    // (undocumented)
    readonly line: string;
    readonly timestamp: number;
    // (undocumented)
    toString(): string;
}

// @public
export class ProcessOutput {
    // (undocumented)
    addStderr(message: ProcessMessage): void;
    // (undocumented)
    addStdout(message: ProcessMessage): void;
    get error(): boolean;
    get exitCode(): number | undefined;
    // (undocumented)
    setExitCode(exitCode: number): void;
    get stderr(): string;
    get stdout(): string;
}

// @public
export function runCode(runtime: CodeRuntime, code: string, opts?: {
    apiKey?: string;
}): Promise<{
    stdout: string;
    stderr: string;
}>;

// @public (undocumented)
export interface RunPythonOpts<S extends DataAnalysis> extends Omit<ProcessOpts, 'cmd'> {
    // (undocumented)
    onArtifact?: (artifact: Artifact<S>) => Promise<void> | void;
}

// @public
class Sandbox extends SandboxConnection {
    protected constructor(opts?: SandboxOpts);
    get actions(): Map<string, Action<any, any>>;
    // (undocumented)
    readonly _actions: Map<string, Action<any, any>>;
    addAction<T = {
        [name: string]: any;
    }>(action: Action<this, T>): this;
    addAction<T = {
        [name: string]: any;
    }>(name: string, action: Action<this, T>): this;
    static create<S extends Sandbox>(): Promise<S>;
    static create<S extends Sandbox>(template: string): Promise<S>;
    static create<S extends Sandbox>(opts: SandboxOpts): Promise<S>;
    downloadFile(remotePath: string, format?: DownloadFileFormat): Promise<string | Blob | ArrayBuffer>;
    readonly filesystem: FilesystemManager;
    get fileURL(): string;
    // (undocumented)
    protected _open(opts: CallOpts): Promise<this>;
    get openai(): {
        readonly actions: Actions;
    };
    readonly process: ProcessManager;
    static reconnect(sandboxID: string): Promise<Sandbox>;
    static reconnect(opts: Omit<SandboxOpts, 'id' | 'template'> & {
        sandboxID: string;
    }): Promise<Sandbox>;
    removeAction(name: string): this;
    readonly terminal: TerminalManager;
    uploadFile(file: Buffer | Blob, filename: string): Promise<string>;
}
export { Sandbox }
export default Sandbox;

// @public (undocumented)
export const SANDBOX_DOMAIN: string;

// Warning: (ae-forgotten-export) The symbol "SandboxConnectionOpts" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface SandboxOpts extends SandboxConnectionOpts {
    // (undocumented)
    onExit?: (() => Promise<void> | void) | ((exitCode: number) => Promise<void> | void);
    // Warning: (ae-forgotten-export) The symbol "ScanOpenedPortsHandler" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    onScanPorts?: ScanOpenedPortsHandler;
    // (undocumented)
    onStderr?: (out: ProcessMessage) => Promise<void> | void;
    // (undocumented)
    onStdout?: (out: ProcessMessage) => Promise<void> | void;
    timeout?: number;
}

// @public
export class Terminal {
    constructor(terminalID: string, sandbox: SandboxConnection, triggerExit: () => void, finished: Promise<TerminalOutput>, output: TerminalOutput);
    // (undocumented)
    get data(): string;
    // @deprecated (undocumented)
    readonly finished: Promise<TerminalOutput>;
    kill(): Promise<void>;
    // (undocumented)
    readonly output: TerminalOutput;
    resize({ cols, rows }: {
        cols: number;
        rows: number;
    }): Promise<void>;
    sendData(data: string): Promise<void>;
    // (undocumented)
    readonly terminalID: string;
    wait(): Promise<TerminalOutput>;
}

// @public
export interface TerminalManager {
    // Warning: (ae-forgotten-export) The symbol "TerminalOpts" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    start(opts: TerminalOpts): Promise<Terminal>;
}

// @public (undocumented)
export class TerminalOutput {
    // (undocumented)
    addData(data: string): void;
    // (undocumented)
    get data(): string;
}

// Warning: (ae-forgotten-export) The symbol "WithAccessToken" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function withAccessToken<T>(f: TypedFetch<T>): WithAccessToken<T> & {
    Error: typeof f.Error;
};

// Warning: (ae-forgotten-export) The symbol "WithAPIKey" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function withAPIKey<T>(f: TypedFetch<T>): WithAPIKey<T> & {
    Error: typeof f.Error;
};

// Warnings were encountered during analysis:
//
// dist/index.d.ts:834:9 - (ae-forgotten-export) The symbol "Actions" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

```
