class TemporalSandboxSession(BaseSandboxSession): (source)
Constructor: TemporalSandboxSession(name, config, state, supports_pty_flag)
A BaseSandboxSession that routes all I/O through Temporal activities.
This class is fully stateless with respect to the physical sandbox -- it holds only the serializable SandboxSessionState and a supports_pty flag (both provided by the worker-side SessionResult).
Activity names are prefixed with the provider name so that dispatches reach the correct sandbox backend's activities on the worker.
Each activity receives a single Pydantic model instance. Because the Temporal client is configured with pydantic_data_converter, all fields are serialized and deserialized automatically.
| Method | __init__ |
Initialize the session. |
| Async Method | exec |
Execute a command in the sandbox via activity. |
| Async Method | hydrate |
Hydrate the workspace via activity. |
| Async Method | persist |
Persist the workspace via activity. |
| Async Method | pty |
Start a PTY exec via activity. |
| Async Method | pty |
Write to PTY stdin via activity. |
| Async Method | read |
Read a file from the sandbox via activity. |
| Async Method | running |
Check if the sandbox is running via activity. |
| Async Method | shutdown |
Shut down the sandbox via activity. |
| Async Method | start |
Start the sandbox session via activity. |
| Method | state |
Undocumented |
| Async Method | stop |
Stop the sandbox session via activity. |
| Method | supports |
Whether this session supports PTY operations. |
| Async Method | write |
Write a file to the sandbox via activity. |
| Property | state |
The current session state. |
| Async Method | _exec |
Undocumented |
| Instance Variable | _config |
Undocumented |
| Instance Variable | _name |
Undocumented |
| Instance Variable | _state |
Undocumented |
| Instance Variable | _supports |
Undocumented |
str, config: ActivityConfig, state: SandboxSessionState, supports_pty_flag: bool = True):
(source)
¶
Initialize the session.
str | Path, timeout: float | None = None, shell: bool | list[ str] = True, user: str | User | None = None) -> ExecResult:
(source)
¶
Execute a command in the sandbox via activity.
str | Path, timeout: float | None = None, shell: bool | list[ str] = True, user: str | User | None = None, tty: bool = False, yield_time_s: float | None = None, max_output_tokens: int | None = None) -> PtyExecUpdate:
(source)
¶
Start a PTY exec via activity.
int, chars: str, yield_time_s: float | None = None, max_output_tokens: int | None = None) -> PtyExecUpdate:
(source)
¶
Write to PTY stdin via activity.