# TaskPulse β€” AI Agent Scheduled Task Monitor > **Let your AI agents self-report. You just glance at the dashboard.** TaskPulse is a tracking and monitoring platform designed for AI agents' scheduled tasks. Unlike traditional CRUD-heavy admin panels, TaskPulse is **AI-native**: give your agents an API spec, and they autonomously register themselves, report execution results, and update their status β€” no manual form-filling required. [πŸ“– δΈ­ζ–‡ζ–‡ζ‘£](./README.md) --- ## Philosophy ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ TaskPulse Dashboardβ”‚ β”‚ Unified Status Viewβ”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”˜ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ └─────────────────┐ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ AI Agent A β”‚ register tasks β†’ execute β”‚ AI Agent B β”‚ β”‚ β”œβ”€ data sync β”‚ ← report result + log β”‚ β”œβ”€ order fetch β”‚ β”‚ └─ report gen β”‚ β”‚ └─ inventory sync β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` **AI-Native by Design** Traditional schedulers require humans to fill forms and manage cron expressions. But AI agents can read API docs and act autonomously: 1. **Self-Register** β€” One API call to register both the agent and all its tasks 2. **Report Results** β€” After each execution, POST back the result with logs and duration 3. **Auto-Alert** β€” If a task misses its window, the system alerts automatically The only thing humans need to do: **open the dashboard and see the big picture.** --- ## Features ### πŸ€– AI-Native Onboarding - **Batch Registration**: `POST /api/agents/register-with-tasks` β€” agent + tasks in one shot - **API Key Auth**: Each agent gets its own key for reporting - **Re-registration**: Deleted agents can re-register anytime - **Agent Avatars**: First-letter + deterministic color avatars for quick visual identification ### πŸ“Š Unified Dashboard - **Summary Cards**: agent count, task count, 24h executions, pending alerts - **Global Task View**: all tasks from all agents in one place - **Task Tags**: label tasks (e.g. "data-sync", "critical"), filter by tags - **Human-Readable Cron**: `*/5 * * * *` β†’ "Every 5 minutes" - **Localized Time**: all timestamps auto-converted from UTC to browser timezone ### ⏱ Execution Tracking - **Live Reporting**: agents POST results immediately after execution - **Execution History**: full timeline per task, paginated - **Log Viewer**: dark terminal-style viewer for debugging - **Search & Filter**: by task name, tags, and status ### 🚨 Timeout Alerts & Notifications - **Auto-Scan**: background scheduler checks overdue tasks every 60s - **Grace Window**: per-task tolerance to avoid false alerts - **Multi-Channel**: Feishu (Lark) webhook, email SMTP, generic webhook - **Alert Acknowledgment**: mark alerts as handled for closed-loop management ### 🎨 Modern UI - **Dark Theme**: gradient backgrounds + neon accents - **Full-Width Layout**: maximizes screen usage - **Responsive**: adapts to different screen sizes --- ## Tech Stack | Layer | Technology | |---|---| | Backend | Python FastAPI (async) | | Production Server | Gunicorn + Uvicorn Worker | | Frontend | Vue 3 + Element Plus | | Build Tool | Vite | | Database | MySQL 8.0 | | Validation | Pydantic v2 | | ORM | SQLAlchemy 2.0 (async) | | Auth | JWT (python-jose) + bcrypt | | Scheduler | APScheduler (async loop) | | Deployment | Monolithic (FastAPI serves SPA) | --- ## Quick Start ### Local Development ```bash # 1. Clone git clone https://github.com/oventh/TaskPulse.git cd TaskPulse # 2. Backend cd backend python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt cp .env.example .env # edit .env with your DB config uvicorn app.main:app --reload --port 8000 # 3. Frontend (new terminal) cd frontend npm install npm run dev # http://localhost:3000 ``` > Frontend dev server proxies `/api` to `localhost:8000`. ### Production Deployment ```bash # 1. Build frontend cd frontend && npm install && npm run build # 2. Deploy to server rsync -avz --exclude='.venv' --exclude='node_modules' --exclude='.git' \ ./ user@server:/home/app/taskpulse/ # 3. Install deps + start with Gunicorn cd /home/app/taskpulse/backend python3 -m venv .venv && .venv/bin/pip install -r requirements.txt .venv/bin/gunicorn app.main:app \ -k uvicorn.workers.UvicornWorker \ -b 0.0.0.0:8000 -w 2 --preload --daemon ``` --- ## Agent Integration Let your AI agent self-register in 3 steps: ```python import requests BASE = "https://your-domain.com" # 1. Register agent + all its tasks (one API call) resp = requests.post(f"{BASE}/api/agents/register-with-tasks", json={ "name": "my-agent", "description": "My AI Agent", "tasks": [ {"name": "sync-data", "cron_expression": "*/5 * * * *"}, {"name": "daily-report", "cron_expression": "0 9 * * *"} ] }) data = resp.json() API_KEY = data["agent"]["api_key"] # ← save this AGENT_ID = data["agent"]["id"] # 2. Report execution result after each run requests.post(f"{BASE}/api/tasks/{TASK_ID}/executions", headers={"Authorization": f"Bearer {API_KEY}"}, json={"status": "success", "duration_ms": 1500, "log": "Task completed"}) ``` > For curl, batch registration, and more examples, see the Chinese doc [AGENT_GUIDE.md](./AGENT_GUIDE.md). --- ## Configuration | Variable | Default | Description | |----------|---------|-------------| | `TASKPULSE_DB_HOST` | localhost | MySQL host | | `TASKPULSE_DB_PORT` | 3306 | MySQL port | | `TASKPULSE_DB_USER` | dbuser | Database user | | `TASKPULSE_DB_PASSWORD` | - | Database password | | `TASKPULSE_DB_NAME` | taskpulse | Database name | | `TASKPULSE_DEBUG` | true | Debug mode (false in production) | | `TASKPULSE_SECRET_KEY` | - | JWT signing key | | `TASKPULSE_SMTP_*` | - | Email notification config | See `backend/.env.example` for the full list. --- ## API Overview ### Agents | Method | Path | Description | |--------|------|-------------| | POST | `/api/agents` | Register an agent (returns API Key) | | **POST** | **`/api/agents/register-with-tasks`** | **🌟 Batch register agent + tasks** | | GET | `/api/agents` | List all agents | | PUT | `/api/agents/{id}` | Update agent name/description | | DELETE | `/api/agents/{id}` | Delete agent (cascades to tasks) | ### Tasks | Method | Path | Description | |--------|------|-------------| | POST | `/api/tasks?agent_id=X` | Create a scheduled task | | GET | `/api/tasks` | List tasks (`?q=&tags=&status=` filters) | | PUT | `/api/tasks/{id}` | Update task name/tags/description | | DELETE | `/api/tasks/{id}` | Delete a task | ### Execution Reporting | Method | Path | Description | |--------|------|-------------| | POST | `/api/tasks/{id}/executions` | **Agent reports execution result** | | GET | `/api/tasks/{id}/executions` | View execution history (paginated) | | GET | `/api/tasks/{id}/executions/{eid}` | View single execution detail | ### Dashboard & Config | Method | Path | Description | |--------|------|-------------| | GET | `/api/dashboard/summary` | Dashboard summary stats | | GET | `/api/dashboard/tasks` | Dashboard full task view | | GET | `/api/system/config` | Get system config | | PUT | `/api/system/config` | Update system config (Base URL) | ### Alerts & Notifications | Method | Path | Description | |--------|------|-------------| | GET | `/api/alerts` | List alerts | | POST | `/api/alerts/{id}/acknowledge` | Acknowledge an alert | | POST | `/api/notification-channels` | Add notification channel | Full OpenAPI docs at `/docs` (Swagger UI). --- ## Project Structure ``` taskpulse/ β”œβ”€β”€ backend/ β”‚ β”œβ”€β”€ app/ β”‚ β”‚ β”œβ”€β”€ main.py # FastAPI entry + SPA static files + lifecycle β”‚ β”‚ β”œβ”€β”€ config.py # Environment variables (pydantic-settings) β”‚ β”‚ β”œβ”€β”€ database.py # Async MySQL connection β”‚ β”‚ β”œβ”€β”€ models/ # SQLAlchemy models (6 tables) β”‚ β”‚ β”œβ”€β”€ schemas/ # Pydantic request/response models β”‚ β”‚ β”œβ”€β”€ api/ # REST API routes (7 modules) β”‚ β”‚ └── services/ # Business logic layer β”‚ β”‚ β”œβ”€β”€ scheduler.py # ⏰ Background scheduler (timeout detection) β”‚ β”‚ └── notification.py # πŸ“’ Feishu/Email/Webhook sender β”‚ β”œβ”€β”€ alembic/ # DB migrations β”‚ └── requirements.txt β”œβ”€β”€ frontend/ β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ views/ # 6 pages (dark theme) β”‚ β”‚ β”œβ”€β”€ router/ # Route guards + login redirect β”‚ β”‚ β”œβ”€β”€ api/ # Axios client + 401 interceptor β”‚ β”‚ └── assets/ # Global styles + Element Plus overrides β”‚ └── package.json β”œβ”€β”€ AGENT_GUIDE.md # Agent API guide (Chinese) β”œβ”€β”€ README.md # Documentation (Chinese) └── README.en.md # Documentation (English) ``` --- ## License MIT License Β© 2026