What is Execute Terminal Command?
Execute Terminal Command is a specialized tool that allows your agent to run PowerShell commands on the Windows machine during workflow execution. This enables system-level operations, file manipulations, and integrations that go beyond GUI interactions.In your prompts, always refer to this tool as
execute_terminal_command (lowercase, with underscores).Why This Tool Exists
Many enterprise workflows require system-level operations:- File system operations (copy, move, delete, rename)
- System administration tasks
- API calls and web requests
- Data processing and transformation
- Integration with command-line tools
- Batch operations on multiple files
execute_terminal_command tool ensures these operations are performed consistently, even during cached workflow runs.
Session Behavior
Persistent by default:
execute_terminal_command reuses the same PowerShell session by default within a workflow run.- Variables, the current directory, and other shell state can carry over between consecutive terminal commands
Timeout Behavior
By default, execute_terminal_command waits up to 30 seconds for a command to complete. For long-running operations, you can specify a custom timeout using theduration parameter.
Cyberdriver 1.0.2+: If a one-shot PowerShell command reaches its timeout, Cyberdriver returns control to Cyberdesk but lets the command keep running in the background. To avoid runaway resource usage, Cyberdriver allows up to 10 timed-out background PowerShell commands at once; additional timed-out commands are terminated until a background slot is released.
Using Duration Parameter
Background Execution
On Cyberdriver 1.0.2+, when a one-shot command exceeds its timeout and a background slot is available, it continues running in the background while the workflow proceeds. This is useful for:- Fire-and-forget operations
- Long-running background tasks
- Commands that write output to files
Best Practices for Long Commands
- Redirect output to files - Use
> output.txtor-RedirectStandardOutput - Don’t rely on command output - If timeout is reached, stdout/stderr will be empty
- Verify completion separately - Use subsequent commands or focused_action to check results
- Use appropriate timeouts - Match duration to expected command runtime
PowerShell Syntax Guide
❌ Unix/Bash Commands (DON’T USE)
✅ PowerShell Equivalents (USE THESE)
How to Prompt for Terminal Commands
Best Practices
- Use PowerShell Syntax: Always use proper PowerShell cmdlets
- Include ConvertTo-Json: For commands that return objects, pipe to
ConvertTo-Jsonto avoid truncation - Handle Dynamic Commands: Use input variables for commands that change between runs
- Specify Full Paths: Use absolute paths when working with files
- Error Handling: Consider what should happen if a command fails
- Use a Workflow Allowlist For Sensitive Flows: If a workflow only needs a small set of terminal commands, configure the workflow’s terminal command allowlist so the agent can only run those approved command templates
Prompt Template
Workflow Terminal Allowlist
Cyberdesk workflows can optionally define a terminal command allowlist in the workflow editor. When present:- The allowlist is enforced server-side before a command is sent to Cyberdriver.
- The agent may only run commands that match one of the approved command templates, or the resolved command produced from that template for the current run.
- Allowlist templates may include input values like
{value}, sensitive values like{$value}, runtime values like{{value}}, and loop-item runtime values like{{loop_item}}. working_directoryis not allowed with an active allowlist. Prefer explicit paths inside the approved command itself.- Dynamic input or runtime variables are still fine as long as the resulting command matches an approved template.
Using Persistent Shell State
Real-World Examples
File Operations
API Integration
Data Processing
System Information
Common PowerShell Commands
File and Directory Operations
Text Processing
Web Requests
Dynamic Commands with Variables
Using Workflow Input Variables
Using Runtime Variables
Building Dynamic Commands
Conditional Command Execution
Sensitive Variables in Terminal Commands
Use
{$variable} for secrets required by terminal actions (e.g., tokens). Secrets are never logged or sent to LLMs and are resolved only at execution time. Avoid echoing them in command output or saving them to files.Best Practices
- Do not print secrets (avoid
Write-Hostof secret values) - Prefer passing secrets to commands that do not echo them to stdout
- Never persist secrets to disk or logs
- If a command would reveal the secret in output, capture only status and verify success via UI with
focused_action
Example
Advanced Patterns
Batch Processing
System Monitoring
Log Analysis
Integration with Other Tools
With File Export
With Focused Action
Creating Reports
Error Handling
Checking Command Success
Graceful Failures
Best Practices Summary
- Always use PowerShell syntax, not Unix/Bash commands
- Pipe object output to
ConvertTo-Jsonto see full results - Use absolute paths for file operations
- Consider using
-Forceparameters to avoid prompts - Handle errors gracefully with
-ErrorAction - Test complex commands before including in workflows
- Use input variables for dynamic command components
- Reuse the default persistent session when follow-up commands depend on earlier shell state