Task Command
The task command enables you to describe a task you want to accomplish, and the agent will generate and execute commands to complete it.
Usage
The agent will: 1. Interpret your task description 2. Generate appropriate commands to accomplish the task 3. Ask for your permission before executing any commands 4. Provide the results
Examples
# List files
agent task "List all files in the current directory sorted by size"
# Find specific files
agent task "Find all .go files modified in the last week"
# Process text
agent task "Count the number of lines in all .md files"
# System information
agent task "Show me information about my CPU and memory usage"
Python Automation (Native)
The task agent can draft and run Python scripts using native tools (no cat <<EOF), then execute them with python3, python, or uv run python.
Prerequisites
python3orpythonavailable on your PATH- Optional:
uvfor fast, isolated execution
Example
# Write hello.py and run it
agent task "Create hello.py that prints Hello, run it with python3"
# Use uv when available
agent task "Create hello.py that prints Hello, run it with uv run python"
If you need PEP 723 script mode, ask for uv run --script explicitly.
You will be asked to confirm each execution step. File creation and edits are performed by the agent’s native tools.
Flags
| Flag | Short | Default | Description |
|---|---|---|---|
--provider |
-p |
From config | The LLM provider to use |
--model |
-m |
From config | The model ID to use |
--print |
-x |
true |
Whether to print the response to stdout |
--log |
-l |
false |
Whether to log the input and output to a file |
--plain |
-k |
false |
Render the response as plain text (no markdown) |
--allow |
[] |
Allow actions without confirmation (repeatable, regex-based) |
Action strings use a function-style format, e.g. unix("aws login sso") or file_edit("README.md", operation="write"). All strings are treated as regex and must match the full value. To constrain keys, use allowKeys=["region", "profile"] (regex allowed), and key values can be regex too, e.g. region="us-.*".
Safety Features
The task command includes safety measures:
- Command Confirmation: Before executing any generated command, the agent will show you the command and ask for confirmation.
- Limited Command Set: Only certain safe commands are allowed to be executed automatically.
- Iterative Approach: The agent breaks down complex tasks into smaller steps, with visibility at each stage.
Limitations
Currently, the task command has some limitations:
- Not all Unix commands are supported for automatic execution
- Some advanced operations may require manual intervention
- The task command is not supported by the Perplexity provider
History and Logging
Using the --log flag will save your task and the response to the history log:
You can query your history with the history command.