Skip to content

FaisalQ05/task-ai-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Intelligent Task Processing

The AI does not simply save raw user messages as task titles.

Instead, it extracts meaningful task names from natural language.

Example

User Input:

I have to submit my final project tomorrow

Extracted Task:

Submit My Final Project

Supported Cleanup

The system automatically removes phrases such as:

I have to
I need to
Remind me to
Please
Add task
Create task
New task
I should
I must

🎯 Task Priorities

Supported priorities:

Priority Icon
High 🔴
Medium 🟡
Low 🟢

Example:

{
  "title": "Submit report",
  "priority": "high"
}

📅 Due Date Support

Tasks can include optional due dates.

Example:

{
  "title": "Submit report",
  "dueDate": "2026-06-15"
}

Response:

✅ Task saved: "Submit Report" 🔴 high priority | 📅 Due: Mon Jun 15 2026

🚫 Duplicate Protection

The system prevents duplicate pending tasks.

Example:

User: I need to buy groceries

If the task already exists:

⚠️ Task "Buy Groceries" already exists and is pending.

🔍 Smart Task Matching

When completing or deleting tasks, exact names are not required.

Example:

Existing Task:

Buy Groceries For Weekend

User:

Complete groceries

The system performs a case-insensitive search and finds the correct task.


📋 Task Status Management

Supported statuses:

pending
done

Task Lifecycle:

Create Task
     ↓
Pending
     ↓
Complete Task
     ↓
Done

📊 Task Dashboard

When listing tasks, results are grouped automatically.

Example:

📋 PENDING TASKS

1. 🔴 Submit Report
2. 🟡 Buy Groceries

✅ COMPLETED TASKS

1. ✓ Call Doctor

📊 Summary: 2 pending, 1 completed

🔄 Agent Workflow

The task agent follows a strict state-machine architecture.

User
 ↓
Plan
 ↓
Action
 ↓
Observation
 ↓
Output

Supported Actions:

saveTask
getTasks
completeTask
deleteTask

🛡️ Reliability Features

Loop Detection

Prevents infinite reasoning cycles.

if (sameTypeCount > 2) {
  return state.observation;
}

Iteration Limit

Maximum:

5 iterations

per request.

Function Whitelisting

Only approved functions may execute.

saveTask;
getTasks;
completeTask;
deleteTask;

Safe JSON Parsing

The agent automatically repairs malformed LLM responses:

  • Invalid JSON
  • Escaped quotes
  • Unicode issues
  • Markdown code blocks

💾 Database Storage

Tasks are persisted in MongoDB.

Task Schema Fields:

title;
priority;
status;
dueDate;
createdAt;
updatedAt;

This allows tasks to survive application restarts and remain available across sessions.


📈 Example User Scenarios

Add Task

User:
I need to submit my assignment tomorrow

AI:
✅ Task saved: "Submit My Assignment" 🔴 high priority

Show Tasks

User:
Show my pending tasks

AI:
📋 PENDING TASKS

1. 🔴 Submit My Assignment
2. 🟡 Buy Groceries

📊 Summary: 2 pending, 0 completed

Complete Task

User:
I finished the assignment

AI:
🎉 Task completed: "Submit My Assignment"! Great job! ✅

Delete Task

User:
Delete groceries

AI:
🗑️ Task deleted: "Buy Groceries"

About

AI-powered task management agent built with TypeScript, Express, MongoDB, and LLM tool-calling. Supports natural language task creation, completion, deletion, and intelligent task retrieval.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages