Skip to content

Code Interpreter

Code Interpreter

Code Interpreter extends Python-based coding environments with integrated data analysis, enabling developers to run scripts, visualize results, and prototype solutions inside supported platforms. With the integration in SquadOS, your agents gain access to an isolated Python execution environment in the cloud — they can run code, read and write files, execute terminal commands, and get real-time results, without needing any infrastructure of their own.

This tool uses no authentication (NO_AUTH) to connect.

FieldRequiredDescription
N/ANoThis tool does not require credentials.
  1. Go to Tools in the side menu (/admin/tools).
  2. Open the Available tab and search for Code Interpreter.
  3. Click the card to open the details and hit Activate — the tool goes straight to the active list, with no login step. (Connection-flow details in Organization Tools.)

CODEINTERPRETER_CREATE_SANDBOX

Create a sandbox to execute Python code in a Jupyter notebook cell. This is useful for agents to communicate, execute code, see output, read files, write files, etc. It’s like your own personal computer, but in the cloud. Use the /home/user folder to write/read files.

NameTypeRequiredDescription
keep_aliveintegerNoThe number of seconds to keep the sandbox alive after creation. Default is 300 seconds (5 minutes). Can be between 0 and 3600.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

CODEINTERPRETER_EXECUTE_CODE

Execute Python code in a sandbox and return any result, stdout, stderr, and error. Use the /home/user folder to write/read files. Try to not use plt.show() as the code is executed remotely. Use files for image/chart output instead.

NameTypeRequiredDescription
timeoutintegerNoThe timeout in seconds for the execution of the code.
keep_aliveintegerNoThe number of seconds to keep the sandbox alive after execution. Default is 300 seconds (5 minutes). Can be between 0 and 3600.
sandbox_idstringNoThe ID of the sandbox to execute the code in. Try to find an existing sandbox ID from context in order to access the previous modification session. In case not found, this value might be omitted, a new sandbox will be created.
code_to_executestringYesThe Python code to execute in a single cell. If a file is to be saved, it should be saved under the /home/user/ directory. At the end of the code, a success message print is good to have.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

CODEINTERPRETER_GET_FILE_CMD

Get a file from the sandbox and returns the file. The files should be read from the /home/user folder.

NameTypeRequiredDescription
timeoutintegerNoThe timeout in seconds for the command to run.
file_pathstringYesThe path (on the sandbox) of the file to get. Give an absolute path. Should start with /home/user/.
sandbox_idstringYesThe ID of the sandbox where the file has been created.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

CODEINTERPRETER_RUN_TERMINAL_CMD

Run a command in the terminal and returns the stdout, stderr, and error code. Use the /home/user folder to write/read files.

NameTypeRequiredDescription
commandstringYesThe command to run in the terminal.
timeoutintegerNoThe timeout in seconds for the command to run.
keep_aliveintegerNoThe number of seconds to keep the sandbox alive after execution. Default is 300 seconds (5 minutes).
sandbox_idstringNoThe ID of the sandbox to execute the code in. Try to find an existing sandbox ID from context in order to access the previous modification session. In case not found, this value might be omitted, a new sandbox will be created.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

CODEINTERPRETER_UPLOAD_FILE_CMD

Upload a file to the sandbox environment. The files should be uploaded to the /home/user folder.

NameTypeRequiredDescription
fileobjectYesThe file to upload, containing the file name and base64-encoded content.
overwritebooleanNoWhether to overwrite the file if it already exists.
sandbox_idstringYesThe ID of the sandbox where the file will be uploaded.
destination_pathstringYesThe destination path in the sandbox where the file will be saved. Provide an absolute path starting with /home/user/. The file name from file will be appended if destination_path is a directory.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.