Skip to content
Browse docs

Guides

Files and commands

Execute commands, continue interactive work, and read, write, edit, or blame files.

On this page+

Run a command

exec_command takes shell command text as its final positional argument. Quote commands that contain spaces or shell operators. The optional timeout limits total execution, while --yield-time-ms controls only the first output wait.

Shell
sandbox-runtime-cli --sandbox-id eos-abc exec_command pwd
sandbox-runtime-cli --sandbox-id eos-abc exec_command --yield-time-ms 0 "sleep 30"

With no workspace-session ID, the runtime creates an automatic session and publishes changes after its final command reaches terminal state. Use an existing --workspace-session-id only when your integrating surface has supplied one.

Continue interactive work

A still-running response includes a command_session_id. Write plain text to its stdin, or send the terminal control character expected by the program. The CLI’s positional TEXT argument is appended to the input stream.

Shell
sandbox-runtime-cli --sandbox-id eos-abc write_command_stdin --command-session-id cmd-1 hello
sandbox-runtime-cli --sandbox-id eos-abc write_command_stdin --command-session-id cmd-1 --yield-time-ms 1000 "$'\003'"

The second example uses the shell’s ANSI-C quoting to send Ctrl-C. Ctrl-D is also accepted by a still-running command when the program should receive end-of-input.

Read stable output

Command transcripts use stable zero-based line offsets. Read from offset zero first, then continue from the next offset returned or implied by the rows consumed. The default limit is 200 and the maximum is 1000.

Shell
sandbox-runtime-cli --sandbox-id eos-abc read_command_lines --command-session-id cmd-1 --start-offset 0 --limit 100

Read and write files

Paths may be repository-relative or workspace-root absolute. A read without a workspace-session ID uses the latest published snapshot; a write without one publishes a layer attributed to operation:<request_id>.

Shell
sandbox-runtime-cli --sandbox-id eos-abc file_read --path src/main.rs --offset 20 --limit 40
sandbox-runtime-cli --sandbox-id eos-abc --request-id note-1 file_write --path notes.txt --content "hello"

Edit and blame

file_edit accepts an ordered JSON array of exact-string replacements. Each old string must be unique unless replace_all is true. file_blame then reports the opaque owner of each published line.

Shell
sandbox-runtime-cli --sandbox-id eos-abc file_edit --path notes.txt --edits '[{"old_string":"hello","new_string":"hello sandbox"}]'
sandbox-runtime-cli --sandbox-id eos-abc file_blame --path notes.txt

Ownership values are workspace_session:<id>, operation:<id>, original, or unknown. For publication semantics and export, continue to Publish and export changes.

58 results