When to use
When you need to run Python to process PDFs/spreadsheets, pip install dependencies, call pandoc/soffice, batch rename, etc.
Pre-checks
- Read the workspace
ENV.md's C/D tier and run status - If not yet probed and the task depends on run:office-env-setup probe quickly or confirm directly with the user
runoff → do not execute commands; use the desktop/Markdown fallback and explain the configuration item
Tools
tools workflow run:
- Default cwd = Agent workspace
- Constrained by
aistream.tools.file.runEnabled、runTimeoutMs、maxCommandOutputCharsConstraints - Overly long output will be truncated → redirect the result
writeto a file and thenread
Safety checklist
Before execution, explain:
- the command text
- impact(which files are written, whether pip uses the network)
- and run only after the user confirms (deletion, pip install, curl upload)
Common office commands
python script.py
pip install --user pypdf pdfplumber python-pptx pandas openpyxl matplotlib
pandoc report.md -o report.docx
soffice --headless --convert-to pdf file.docx
On Windows, mind path quoting; prefer paths relative to the workspace.
On failure
| Error | Handling |
|---|---|
| run disabled | See office-env-setup → inform about runEnabled |
| python not found | Try python3 / py -3; if still missing, fall back |
| pip fails | Record stderr, do not retry the install; deliver via fallback |
| command does not exist | pandoc/soffice/qpdf → switch to Python or the desktop path |
| timeout | Split into smaller scripts or increase runTimeoutMs (requires the user to change the configuration) |
Dependency reference: see office-env-setup task fallback table.
Prohibited
- Do not execute
rm -rf /, format disks, change the firewall, etc. - Global pip install without confirmation