File paths and directories within the sandbox
When your tool executes within the sandboxed
environment,
the following points
are
valid for file paths and directories:
- The current working directory is automatically configured as /workspace using the --chdir /workspace command within the sandbox.
- All
relative paths that are
not
prefixed with a leading
/resolve relative to the current working directory, which is the /workspace directory. - 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 located in the /workspace directory.
Example
forautomatic
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"When the tool runs, you have the following execution environment details:
- 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.
