Overview
The terminal commands capability gives your Utari workers the power to execute shell commands, install packages, run scripts, and interact with the command line interface in your workspace. This powerful tool enables workers to perform technical tasks like setting up environments, running builds, executing scripts, and managing processes.Terminal Command Capabilities
Your workers can execute four types of terminal operations:Execute Command
Run shell commands in blocking or non-blocking mode with full control over execution
Check Command Output
Monitor the progress and output of non-blocking commands running in background sessions
List Commands
View all running tmux sessions and their current status
Terminate Command
Stop running commands by killing their tmux sessions
Terminal commands execute in your workspace directory and have access to standard shell utilities, package managers, and installed tools.
Execute Command
The core capability for running shell commands with two execution modes:Blocking Mode (Synchronous)
When to Use:- Quick commands that complete in seconds
- Package installations
- File operations (copy, move, delete)
- Build processes
- Script execution that completes quickly
- Any command where you need immediate results
Non-Blocking Mode (Asynchronous)
When to Use:- Long-running processes
- Development servers
- Watch processes
- Background jobs
- Continuous monitoring tasks
- Any command that runs indefinitely
Command Execution Examples
Installing Dependencies
- Node.js/NPM
- Python/Pip
- System Packages
Running Scripts
File and Directory Operations
Check Command Output
Monitor non-blocking commands running in background sessions.1
Execute Non-Blocking Command
Start a command in non-blocking mode (blocking=false).
2
Get Session Information
Note the tmux session ID returned when the command starts.
3
Check Output
Use check_command_output with the session ID to view progress and output.
4
Monitor Periodically
Call check_command_output multiple times to track ongoing progress.
Example Workflow
List Commands
View all active tmux sessions to see what’s currently running. Use Cases:- Check which background processes are active
- Identify session IDs for monitoring
- Verify servers are still running
- Audit workspace processes
- Troubleshoot command execution
Terminate Command
Stop running commands by killing their tmux sessions.1
Identify Session
Use list_commands to find the session ID of the command you want to stop.
2
Terminate Session
Call terminate_command with the session ID.
3
Verify Termination
Optionally use list_commands again to confirm the session is stopped.
Choosing Execution Mode
Use Blocking Mode (blocking=true) For:
Quick Operations
Commands that complete in seconds or minutes
Package Installation
npm install, pip install, apt-get install
File Operations
Copy, move, delete, create files and folders
Build Processes
npm run build, make, compilation tasks
Script Execution
Short scripts that complete and exit
System Commands
Configuration, setup, one-time operations
Use Non-Blocking Mode (blocking=false) For:
Servers
Development servers, web servers, API servers
Watch Processes
File watchers, auto-recompiling tools
Long-Running Jobs
Data processing, large file operations
Monitoring
Continuous monitoring scripts
Background Tasks
Tasks that should run while you do other work
Interactive Programs
Programs that require ongoing interaction
Common Workflows
Setting Up a Development Environment
1
Update System
2
Install Dependencies
3
Install Project Packages
4
Start Development Server
5
Verify Server
Running Tests and Builds
1
Install Test Dependencies
2
Run Tests
3
Build Project
4
Verify Build Output
Managing Long-Running Processes
1
Start Background Process
2
Monitor Progress
3
List All Processes
4
Terminate When Complete
Best Practices
Choose Right Mode
Use blocking for quick tasks, non-blocking for long-running processes
Monitor Non-Blocking
Always check output of non-blocking commands to verify they’re running correctly
Clean Up Sessions
Terminate completed non-blocking commands to free resources
Handle Errors
Check command exit codes and output for errors
Use Full Paths
Specify complete file paths to avoid ambiguity
Test Commands First
Test complex commands manually before automating
Include Flags
Always use required flags (like —break-system-packages for pip)
Document Sessions
Keep track of what each non-blocking session is doing
Troubleshooting
Command fails with permission error
Command fails with permission error
Try:
- Using
sudoif appropriate (apt-get, system operations) - Checking file/directory permissions with
ls -la - Ensuring you’re in the correct directory
- Verifying the command syntax is correct
Package installation fails
Package installation fails
For pip:
- Always include
--break-system-packagesflag - Try updating pip:
pip install --upgrade pip --break-system-packages - Check internet connectivity
- Clear cache:
npm cache clean --force - Delete node_modules and reinstall
- Check package.json for syntax errors
Can't check output of blocking command
Can't check output of blocking command
Remember:
- Blocking commands return output directly
- They automatically clean up sessions
- Don’t use check_command_output for them
- The output is in the execute_command response
Non-blocking command not running
Non-blocking command not running
Verify:
- Use list_commands to see active sessions
- Check output with check_command_output
- Look for errors in the command syntax
- Ensure required dependencies are installed
- Try running in blocking mode first to debug
Session appears stuck
Session appears stuck
Solutions:
- Check output to see if it’s waiting for input
- Verify the command is appropriate for non-blocking
- Terminate and restart if necessary
- Check for errors in the command output
Command works locally but fails in Utari
Command works locally but fails in Utari
Check:
- Environment differences (paths, installed packages)
- Missing dependencies
- Different shell or system configuration
- Required system packages not installed
Security Considerations
Advanced Usage
Chaining Commands
Environment Variables
Working with Files
Summary
You’ve successfully learned:How to execute commands in blocking vs non-blocking mode
When to use each execution mode for optimal performance
How to monitor non-blocking commands with check_command_output
How to list and terminate running command sessions
Best practices for package installation and script execution
Common workflows for development environment setup
Troubleshooting techniques for command execution issues