Skip to main content

chat.execution

Execution helpers for TUX local shell and sandbox code execution.

ShellExecutionResult Objects

@dataclass
class ShellExecutionResult()

Normalized result for local shell command execution.

SandboxExecutionResult Objects

@dataclass
class SandboxExecutionResult()

Normalized result for sandbox python execution.

TuxExecutionGateway Objects

class TuxExecutionGateway()

High-level execution abstraction for TUX.

Provides two stable operations used by TUX input prefixes:

  • !: local shell execution (runs where the TUX process runs)
  • !!: python execution in the agent's existing server-side sandbox

Because the TUX runs in a separate OS process from the agent-runtimes server, sandbox code is executed by POSTing to the server's /sandbox/execute endpoint. This reuses the sandbox the server already created for the agent (e.g. the per-agent Jupyter kernel) instead of spinning up a fresh sandbox inside the TUX process.

run_local_shell

async def run_local_shell(command: str) -> ShellExecutionResult

Execute a shell command locally via Python subprocess.

run_sandbox_python

async def run_sandbox_python(code: str) -> SandboxExecutionResult

Execute Python code in the agent's server-side sandbox.

Routes the code to the running agent-runtimes server so the existing sandbox (e.g. the per-agent Jupyter kernel) is reused rather than creating a new one in the TUX process.