Guide
The agent's simplest write — `sh "cat > file"` for one-liners
The simplest way for an agent running on the core to write a file — pipe text into it via the shell. When this beats the dedicated upload tools, and when to stop reaching for it.
5/18/2026 · connect0 · 2 min
The simplest thing an agent running on the core can do — write a file straight to the workspace with a shell redirect.
You don't need an upload tool to put a file on disk. The sandbox shell can do it directly:
> Write "hello world" to /workspace/greeting.txt.
The agent runs:
sh "echo 'hello world' > /workspace/greeting.txt"
Done. No pre-signed link, no audit row labelled "upload", no R2 event notification — just a regular shell command writing to the FUSE-mounted FS.
When this is the right tool
- One-liners —
echo,printf, small heredocs. - The content fits comfortably in the shell command — no escaping nightmare with shell metacharacters or newlines.
- You don't need a permanent record of "this was an upload" —
shlands insandbox_invocation, notupload_link.
When to graduate
- The content has shell metacharacters (quotes, backticks,
$, embedded newlines). Escaping gets fragile fast. Useupload.writewithcontent_text. - The content is binary.
echoandprintfaren't binary-safe. Useupload.writewithcontent_base64, orupload.create_linkfor anything > 1 MiB. - The file is bigger than ~16 KiB.
sh's command field has practical length limits and a giantcat > foomakes a mess of audit logs. - You want the upload to show up as an upload in
info'srecent_uploadsor the dashboard's audit panel.sh "cat >"won't.
A note on tee
sh "cat <<EOF | tee /workspace/foo" and sh "tee /workspace/foo <<<'content'" are the same pattern — same tradeoffs apply. Tee is sometimes nicer because it prints what it wrote, which the agent can read back in the same call.
Next steps
Where this fits
This is the Run your agents pillar of connect0 — the core that connects everything your company runs on. The agent runs on the core and writes directly to the workspace FS with a plain shell command — the lowest-ceremony way to put a file where your agent can act on it. Start building → · All guides →