Guide
Run an agent that iterates on a config file
Hand a config to an agent running on your connect0 core; it edits in place via `sh` and verifies with `cat`. The subtle-but-powerful pattern that turns the sandbox into a live config editor.
5/18/2026 · connect0 · 3 min
An agent running on the core edits your config in place — in an isolated sandbox, verifying every change as it goes.
You have a config file. You want the agent to tweak it — change one value, add a section, refactor the structure. You don't want to copy-paste into a chat window over and over.
The flow
- Upload the config (via
upload.create_linkorupload.write, whichever fits the size). - Tell the agent what to change. Agent edits in place via
sh. - Verify with
sh "cat"(ordiff). - Once happy, retrieve the new version (see the download story — small text is fine via
sh; bigger configs need the workaround until the native download surface ships).
A worked example
You drop next.config.mjs at /workspace/next.config.mjs. Then:
> Add server-side externalisation for @aws-sdk packages.
Agent runs:
sh "cat /workspace/next.config.mjs" # read current state
sh "cat > /workspace/next.config.mjs <<'EOF'
... updated content ...
EOF"
sh "cat /workspace/next.config.mjs" # verify
Or for surgical edits:
sh "sed -i 's/serverExternalPackages: \\[/serverExternalPackages: [\"@aws-sdk\\/client-s3\", /' /workspace/next.config.mjs"
Why this is powerful
- Real, persistent state. Unlike paste-in-chat, the file lives somewhere — across turns, across conversations, across machines.
- The agent can diff.
sh "diff"against a backup, against your local version, against a known-good template. - You can roll back. Keep a backup at
/workspace/configs/backup/and overwrite from it when an edit goes wrong.
Subtle: no undo
Once sh "cat > foo" runs, the previous content is gone. R2 keeps no version history. If you want safety, snapshot first:
sh "cp /workspace/next.config.mjs /workspace/configs/backup/next.config.$(date +%s).mjs"
Then ask the agent to edit. If you don't like the result:
sh "cp /workspace/configs/backup/next.config.<timestamp>.mjs /workspace/next.config.mjs"
When to use upload.write vs sh for edits
- Total rewrite, content is small (< 1 MiB):
upload.writewithcontent_text. Cleaner than a heredoc. - Surgical edit, content is large:
sh "sed"orsh "awk". Don't re-upload the whole file just to change one line. - Format-preserving edits to JSON/YAML/TOML:
sh "yq"/sh "jq". They're available in the default sandbox image.
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 against real, persistent files in your workspace — editing, diffing and rolling back in an isolated sandbox instead of copy-pasting into a chat window. Start building → · All guides →