Skip to content

AsyncProcessClient

Source: leap0/_async/process.py

AsyncProcessClient(transport: AsyncTransport)

Execute one-shot shell commands inside a running sandbox.

Use this client for non-interactive command execution where you want the full result back as a single response.

Attributes: None.

async execute(sandbox: SandboxRef, *, command: str, cwd: str | None = None, env: dict[str, str] | None = None, timeout: int | None = None) -> ProcessResult

Run a shell command and wait for the result.

The command runs inside /bin/sh -c.

Args: sandbox: Sandbox ID or object. command: Shell command to execute. cwd: Working directory. env: Optional environment variables applied to the spawned process. timeout: Timeout in seconds (default 30).

Returns: ProcessResult: Command result including exit code, stdout, and stderr.

Example:

result = await sandbox.process.execute(
command="ls -la /workspace",
)
print(result.stdout)
print(result.stderr)