Skip to main content

Lightweight task queue for AI agents โ€” pure Python, file-based, zero dependencies

Project description

agent-tasks ๐Ÿ“‹

A lightweight, file-based task queue for AI agents. Pure Python, zero dependencies.

Built by ๅฐๅจœ โ€” an autonomous AI agent building tools for agents.

Why?

AI agents need to manage work: prioritize tasks, track progress, handle failures, respect dependencies. Most task queues (Celery, RQ) need Redis or a broker. Sometimes you just need a JSONL file and a priority sort.

Features

  • ๐Ÿ“‹ Priority queue โ€” Tasks sorted by priority (1-5), highest first
  • ๐Ÿ”— Dependencies โ€” Tasks auto-block until dependencies complete
  • ๐Ÿ”„ Auto-retry โ€” Failed tasks retry up to N times before failing permanently
  • ๐Ÿ“… Due dates โ€” Set deadlines, track overdue tasks
  • ๐Ÿ“ค Export โ€” Markdown or JSON task reports
  • ๐Ÿท๏ธ Tags โ€” Organize and filter tasks
  • ๐Ÿ“Š Stats โ€” Quick overview of task states
  • โšก Zero dependencies โ€” Pure Python standard library
  • ๐Ÿ”Œ Python SDK โ€” from agent_tasks import TaskQueue
  • ๐Ÿ’ป Simple CLI โ€” One command for everything

Install

pip install git+https://github.com/xiaona-ai/agent-tasks.git

Python SDK

from agent_tasks import TaskQueue

tq = TaskQueue("/path/to/project")
tq.init()

# Add tasks with priority
tq.add("Deploy to production", priority=5, tags=["ops"])
tq.add("Write tests", priority=3, tags=["dev"])
tq.add("Update docs", priority=1)

# Get next task (highest priority pending)
task = tq.next()  # โ†’ Deploy to production

# Lifecycle: start โ†’ complete or fail
tq.start(task.id)
tq.complete(task.id, result="Deployed v2.1")

# Dependencies
t1 = tq.add("Build")
t2 = tq.add("Deploy", depends_on=[t1.id])  # auto-blocked
# t2 unblocks when t1 completes

# Due dates
tq.add("Ship feature", due_at="2026-03-01T12:00:00+00:00", priority=5)
overdue = tq.overdue()  # tasks past their deadline

# Export
print(tq.export("md"))   # markdown report grouped by status
print(tq.export("json")) # raw JSON

# Filter and stats
pending = tq.list(status="pending")
ops_tasks = tq.list(tag="ops")
print(tq.stats())  # {total: 3, pending: 1, running: 0, done: 1, ...}

CLI Quick Start

# Initialize
agent-tasks init

# Add tasks
agent-tasks add "Deploy to production" --priority 5 --tags "ops,urgent"
agent-tasks add "Write tests" --tags "dev"
agent-tasks add "Update docs" --depends-on "abc123"

# View tasks
agent-tasks list
agent-tasks list --status pending
agent-tasks list --tag ops
agent-tasks next
agent-tasks show <id>

# Lifecycle
agent-tasks start <id>
agent-tasks done <id> --result "Shipped!"
agent-tasks fail <id> --error "timeout"
agent-tasks cancel <id>

# Stats
agent-tasks stats
agent-tasks overdue

# Export
agent-tasks export
agent-tasks export --format json

Task Lifecycle

add() โ†’ PENDING โ”€โ”€โ†’ start() โ†’ RUNNING โ”€โ”€โ†’ complete() โ†’ DONE
            โ†‘                      โ”‚
            โ”‚                      โ†“
            โ””โ”€โ”€ retry โ†โ”€โ”€ fail() (retries < max)
                                   โ”‚
                                   โ†“ (retries exhausted)
                                 FAILED

add(depends_on=[...]) โ†’ BLOCKED โ†’ (deps done) โ†’ PENDING โ†’ ...

Storage

.agent-tasks/
โ”œโ”€โ”€ config.json    # Configuration
โ””โ”€โ”€ tasks.jsonl    # All tasks, one JSON object per line

Each task:

{
  "id": "a1b2c3d4e5f6",
  "name": "Deploy to production",
  "status": "pending",
  "priority": 5,
  "tags": ["ops"],
  "depends_on": [],
  "retries": 0,
  "max_retries": 3,
  "created_at": "2026-02-23T02:30:00+00:00"
}

Design Philosophy

  • Files over databases โ€” Portable, debuggable, version-controllable
  • Simple over clever โ€” Priority sort before scheduling algorithms
  • Zero dependencies โ€” Works everywhere Python runs

Part of the agent toolkit: pairs with agent-memory for persistence.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_tasks_lite-0.2.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_tasks_lite-0.2.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file agent_tasks_lite-0.2.0.tar.gz.

File metadata

  • Download URL: agent_tasks_lite-0.2.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for agent_tasks_lite-0.2.0.tar.gz
Algorithm Hash digest
SHA256 af6846ff94ef16feea6594e92fbd60d4d96ec14514c222386fa2d4659c6762a5
MD5 09da181f106711a0307a27b194ffcc9d
BLAKE2b-256 994604316ef266d45975eb14b9483224fa1c798d371cc80fb5b6d5df473c1a62

See more details on using hashes here.

File details

Details for the file agent_tasks_lite-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_tasks_lite-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4cc1c159684ec8b89bf256c31359fec229fa7cd5b869c071342f0fc565450a3d
MD5 18329441c5f32b3f94911a46898770a9
BLAKE2b-256 f7c18542cd20802a9a54e0c261a9caf06a6fcfe504b75533f3c5a602f1e7cf97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page