Agentic Data Plane

rpk ai sandbox attach

Attach to a process that is running in a sandbox, usually one that rpk ai sandbox shell left running after Ctrl+] then d, or one that a lost connection left behind.

A process on a terminal needs a terminal here too, and is redrawn at your terminal’s size. Output starts at the process’s current end: what it wrote while nobody was attached is not replayed. Ending your input does not close the process’s stdin. A process that already exited prints what the sandbox kept of its output and ends with its exit status.

To leave a process with a terminal, press Ctrl+] then d. Ctrl+C there goes to the process. Without a terminal, Ctrl+C leaves and the process keeps running. With --stdin, the first Ctrl+C is sent to the process and a second one leaves.

On a process with a terminal, input is appended to the process’s stdin. Several attaches, or an attach and the shell that started the process, can type into it together. If the reply to a write is lost, the command stops and reports that the input may not have arrived.

A process without a terminal gets no input from an attach. It is output only, unless you pass --stdin, which appends your input to the process’s stdin. Input appended this way can make a pipeline that rpk ai sandbox shell is feeding lose bytes. A process whose stdin is already closed takes no input even with --stdin, and the attach stays output only. After rpk ai sandbox shell reaches the end of its own piped input, it closes the process’s stdin.

Requires Sandbox.get_process and Sandbox.stream_process_output on the sandbox. Terminal input and resizing use Sandbox.write_process_input and Sandbox.resize_terminal. With --stdin in pipe mode, sending input and forwarding signals use Sandbox.write_process_input and Sandbox.signal_process.

Usage

rpk ai sandbox attach SANDBOX PROCESS [flags]

Examples

This section provides examples of how to use rpk ai sandbox attach.

rpk ai sandbox attach dev shell-1

Output only, then feed a process without a terminal

rpk ai sandbox attach dev job-1
echo more | rpk ai sandbox attach dev job-1 --stdin

Flags

Value Type Description

--stdin

bool

Send input to a process without a terminal, appending it to the process’s stdin.

Global flags

Value Type Description

--config

string

Redpanda or rpk config file; default search paths are ~/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings; -X help for detail or -X list for terser detail.

--ignore-profile

bool

Ignore rpk.yaml and redpanda.yaml; use default settings.

--profile

string

rpk profile to use.

-v, --verbose

bool

Enable verbose logging.