Why bundled scripts matter
Without bundled scripts, every run asks the language model to re-read your agent’s text procedure and re-write the code. That leads to drift:- “Blue” becomes navy one run, cornflower the next
- Edge-case handling quietly changes each time
- A function accepting three inputs might silently take four next run
- Metric definitions (annual return, volume, high/low) shift between runs
Bundled scripts are reference files in the Files tab. They sit alongside any manually uploaded templates, CSVs, or config files and are mounted into the sandbox on every run.
The full lifecycle
Create — the first session writes a script to disk
The agent writes a 
.py file (via the Write tool or a cat > bash command) and runs it. This is the working version, the one you see producing the output you like.
Persist — clicking 'Turn into reusable agent' bundles the script
When you ask “make this reusable” or click Turn into reusable agent, the platform runs a short probe that scans 
The bundled file now shows up in the Files panel on the agent’s detail page:
/tmp/*.py, /home/user/workspaces/*/*.py, and any files the agent wrote via Write. Everything found is uploaded to cloud storage under the new agent’s identity, then registered as an attached file.

Run — the agent reads a manifest and executes the bundled file directly
On every subsequent run, the agent reads 
No re-derivation, no drift. The script runs exactly the same way every time; only the inputs change.
/home/user/agent/app-files.json — a manifest that maps the logical file name (meta_stock_plot.py) to its mounted path (/home/user/workspaces/apps/<appId>/meta_stock_plot.py). It then runs that path verbatim, passing your form inputs as environment variables.
Improve — follow-up messages replace the bundled file
Need to change the chart colors, add a new metric, or fix a bug? Send a follow-up message to the agent describing the change. The agent rewrites the script, stages the new version, and the platform replaces the old file in place. All future runs automatically use the improved version.Examples of follow-ups that update the script:
- “Change the color palette to three shades of blue”
- “Add a 200-day moving average overlay”
- “Output the metrics as CSV instead of JSON”
- “Fix the high/low annotations to show dates on the x-axis”
- “Rename this agent to ‘Portfolio Tracker’”
- “Reword the description”
- “Add a second form field for a comparison ticker”
Parameterize via environment variables
Bundled scripts should read runtime inputs from environment variables, not hardcoded literals. That way one bundled file handles every form submission.id. A form field ticker becomes $TICKER; ma_period becomes $MA_PERIOD.
Managing bundled files
Inspect what’s attached
Open the agent’s detail page and look at the Files panel on the right. Every reference file currently bundled is listed there; click a file to preview its contents. This is useful when you’re debugging unexpected behavior or want to verify a follow-up actually updated the script.Upload manually
Beyond auto-bundled scripts, you can click Upload on the Files panel to add any file up to 10 MB — templates, reference datasets, style guides, SQL fixtures. Uploaded files mount into the sandbox at the same predictable paths as auto-bundled ones and appear in the same manifest.Removing a file
Click the trash icon next to any file in the Files panel to delete it permanently. The agent will stop mounting it on subsequent runs.Troubleshooting
My agent regenerates its script on every run instead of using the bundled version.
My agent regenerates its script on every run instead of using the bundled version.
Two common causes:
- The original script was piped via stdin. Nothing made it to disk, so nothing was staged. Re-create the agent from a fresh session where the script is written to a file first.
- The bundled script has hardcoded values instead of env vars. If your form says
ticker = AAPLbut the bundled script always runsMETA, the agent will rewrite the script every time to get the right input. Parameterize via env vars and the bundled file becomes reusable.
.py file listed, the first issue applies. If there is one, preview it and look for hardcoded literals.A follow-up changed behavior, but past sessions still show the old style.
A follow-up changed behavior, but past sessions still show the old style.
Follow-up updates only affect future runs. Past session records are immutable — they preserve exactly what happened at the time, including the script version in effect then. Run the agent again to see the new version in action.
The Files tab shows my script but the agent isn't running it.
The Files tab shows my script but the agent isn't running it.
The agent only uses the bundled file when the runtime procedure instructs it to. When an agent is created through a follow-up rather than a fresh session, the platform may not automatically wire “run the bundled script” into the procedure. Ask the agent to “run the bundled script from app-files.json” in a follow-up and it will update the procedure to reference the staged file.
Can I edit a bundled script directly without going through chat?
Can I edit a bundled script directly without going through chat?
Not currently. Direct editing is on the roadmap; for now, all updates go through follow-up messages. The upside is that every change is traced in a chat history, so you can see why each revision happened.
Related
Agents
Full reference for the Agents product, including the Files tab, Config tab, and session history.
Agent Runtime Environment
How sandboxes mount reference files, pass form inputs as env vars, and isolate runs from each other.