Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TaskWeaver

TaskWeaver Logo

Local Automation Agent which transforms natural language into executable system tasks with AI-powered planning and code generation.

What is TaskWeaver?

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:

  1. Plan : Generate a clear step-by-step execution strategy
  2. Code : Create safe, runnable Python code
  3. 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.

Features

  • 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

Quick Start

Prerequisites

  • Python 3.8 or higher
  • Ollama installed and running (download here: https://ollama.ai)
  • A model available locally (e.g., ollama pull llama3)

Installation

git clone https://github.com/yourusername/taskweaver.git
cd taskweaver
pip install -r [requirements.txt]

Usage

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

Example Wokflow

$ 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 projects

Requirements

typer==0.9.0
rich==13.7.0
ollama==0.1.0

Safety and Security

TaskWeaver 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

Project Structure

taskweaver/
├── main.py              # Core agent orchestration
├── requirements.txt     # Python dependencies
├── README.md            # Documentation
├── test_sample.txt
└── assets/
|   └── TaskWeaver.png
|   └── diagram.svg

How It Works

How It Works

Common Use Cases

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

Limitations and Consideration

  • 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

Contributing

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

Reference

Future Roadmap

  • Multi-step task chaining
  • Web UI dashboard
  • Task history and logging
  • Custom code templates
  • Integration with external APIs
  • Execution dry-run mode

Support

  • Report bugs on GitHub Issues
  • Share ideas and ask questions in Discussions

About

TaskWeaver is a local AI powered CLI agent that turns natural language instructions into executable Python workflows by planning tasks, generating code, and running it with user approval and built-in safety checks.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages