File Paths and Directories within the Sandbox
When your tool executes within the sandboxed environment, consider the following points
regarding file paths and directories:
- Working Directory: The current working directory is automatically configured as /workspace through the --chdir /workspace command within the sandbox.
- Relative Paths: All relative paths (those not prefixed with a leading /) resolve relative to the current working directory, which is /workspace.
- File Writes: Any files generated during execution are written to the artifact file directory. If any relative paths are employed for file creation, the resulting files are situated within /workspace.
For example, Autiomatic File
Writing:
def run_tool(config, args):
# This file is automatically written to /workspace/output.csv
# No need to specify the full path!
with open("output.csv", "w") as f:
f.write("data,value\n")
f.write("A,1\n")
# This JSON file is also automatically in /workspace/results.json
import json
with open("results.json", "w") as f:
json.dump({"status": "success"}, f)
# Both files are now visible in the Agent Studio UI as artifacts
return "Files created successfully"The execution environment details, when the tool runs are as follows:
- The working directory is set to /workspace.
- File paths are resolved relative to this directory:
- output.csv becomes /workspace/output.csv.
- results.json becomes /workspace/results.json.
- The system automatically tracks and displays all generated files in the user interface.
