Local Automation Agent which transforms natural language into executable system tasks with AI-powered planning and code generation.
TaskWeaver is a command line automation agent that bridges the gap between human intent and system execution. Simply describe what you want to do, and TaskWeaver will:
- Plan : Generate a clear step-by-step execution strategy
- Code : Create safe, runnable Python code
- Execute : Run the code with your approval and safety controls
Perfect for automating repetitive tasks, file organization, data processing, and system maintenance—all from your terminal.
- Natural Language Interface —> Describe tasks in plain English
- Local LLM Integration —> Uses Ollama for on-device AI (privacy-first)
- Safety First Execution:
- Code validation (blocks dangerous patterns)
- User confirmation before running
- Execution timeout protection
- Secure temporary file handling
- Rich Terminal UI —> Beautiful, readable output with syntax highlighting
- Customizable Settings —> Choose your model and timeout limits
- Python 3.8 or higher
- Ollama installed and running (download here: https://ollama.ai)
- A model available locally (e.g., ollama pull llama3)
git clone https://github.com/yourusername/taskweaver.git
cd taskweaver
pip install -r [requirements.txt]python main.py "organize my downloads by file type"
python main.py "create a backup of my documents" --model llama3
python main.py "process all csv files" --timeout 60$ python main.py "count all python files in my projects"
─ TaskWeaver ─────────────────────
Local Automation Agent
───────────────────────────────────
Task: count all python files in my projects
─ Execution Plan ──────────────────
1. Search for .py files recursively
2. Count total files found
3. Display results by directory
───────────────────────────────────
─ Generated Code ──────────────────
import os
from pathlib import Path
count = 0
for root, dirs, files in os.walk(Path.home()):
for file in files:
if file.endswith('.py'):
count += 1
print(f"Total Python files: {count}")
───────────────────────────────────
Execute this code? [y/n]: y
Executing...
Found 1,247 Python files across 12 projectstyper==0.9.0
rich==13.7.0
ollama==0.1.0TaskWeaver implements multiple safety layers:
Code Pattern Validation Blocks:
- os.system()
- subprocess.Popen(), subprocess.call()
- eval(), exec()
- import() User Confirmation —> All generated code must be approved before execution
Execution Timeout —> Prevents infinite loops (default: 30 seconds)
Secure Temp Files —> Uses tempfile.NamedTemporaryFile() with automatic cleanup
taskweaver/
├── main.py # Core agent orchestration
├── requirements.txt # Python dependencies
├── README.md # Documentation
├── test_sample.txt
└── assets/
| └── TaskWeaver.png
| └── diagram.svg
File Organization —> Sort, rename, and organize files
Data Processing —> Parse, transform, and aggregate data
Bulk Operations —> Batch rename, convert, or compress files
Directory Cleanup —> Find duplicates, old files, large folders
System Maintenance —> Generate reports, backups, health checks
- Requires a local Ollama instance running
- Code generation quality depends on the LLM model used
- Some complex tasks may need manual refinement
- Not suitable for live system-critical operations without thorough testing
Contributions are welcome. Please follow these steps:
- Fork the repository
- Create a feature branch (git checkout -b feature/your-idea)
- Commit your changes (git commit -m "Add your feature")
- Push to the branch (git push origin feature/your-idea)
- Open a Pull Request
- Ollama Documentation: https://github.com/jmorganca/ollama
- Typer CLI Framework: https://typer.tiangolo.com/
- Rich Terminal Library: https://rich.readthedocs.io/
- Multi-step task chaining
- Web UI dashboard
- Task history and logging
- Custom code templates
- Integration with external APIs
- Execution dry-run mode
- Report bugs on GitHub Issues
- Share ideas and ask questions in Discussions
