Code & scripts
Let your agent write and run code to process files, check results, and complete custom tasks.
code execution scripts shell bash python javascript sandbox persistent filesystemOn this page
Ask for the result, let the agent write the codeHow execution worksPersistent scripts and inputsWorking with business recordsControl and limitsAsk for the result, let the agent write the code
Opser agents can write and execute scripts as part of getting work done. This is useful when a task needs repeatable calculations, a custom transformation, validation across many files, or a step that does not fit a single app action.
Compare these two exports, normalize the dates, and produce a file listing added, removed, and changed records. Save the comparison script so we can run it again next month.
You do not need to write the script yourself. Explain the inputs, rules, desired output, and what must stay unchanged.
How execution works
The agent uses its file capability to inspect or write source and its shell capability to execute commands. Commands run in the agent's working environment, with the workspace as their starting directory. Results and errors return to the conversation.
The available commands, language runtimes, and libraries depend on that environment. The agent should check what is installed before choosing an approach. A script that has been written is not a script that has run successfully; inspect the execution result and output file.
Persistent scripts and inputs
The agent's filesystem persists across conversations. Save scripts and meaningful inputs with clear names so later tasks can find them. Ask the agent to explain the script's inputs and outputs, especially if someone else will reuse it.
For a recurring comparison, keep the original source unchanged and save each run's output separately. Check a small sample, totals, and missing values before relying on the complete result. A schedule can reuse a working approach when the necessary files and access are available.
Working with business records
Use app tools for records owned by an app, and the data capability for supported user-managed datasets. Running code does not grant access to another app's private tables, a colleague's files, or a service that has not been connected.
The agent can combine these capabilities: retrieve authorized data, process it in its workspace, and write the result back through the supported interface. Ask it to show the destination and proposed changes before a consequential update.
Control and limits
Shell execution is restricted to the agent's environment, and the tool can be disabled by an agent's tool restrictions. Commands do not inherit the platform process's secret configuration. Changes such as deletion, overwriting, publishing, or external writes can require approval under the action's rules.
Code can still make mistakes. Give the agent a review point for important work and verify the output. Long-running or unavailable commands can fail; ask for the actual error and completed steps before retrying.
A saved script is also different from a deployed app. If teammates need a durable interface and shared workflow, use the internal app builder.