Focus Buddy is an autonomous AI agent that helps you plan deep-work sessions intelligently.
It uses LangGraph for reasoning, routing, and reflection, and now, with persistent memory, it remembers your past sessions to personalize your focus plans.
Focus Buddy v4.0 marks a major leap in my Agentic AI Learning-in-Public series.
For the first time, the agent becomes both:
- World-aware - it reads your calendar and tasks (via MCP-style context tools)
- Self-aware - it learns from your fatigue, breaks, and focus patterns over time
This creates a deeply adaptive planning agent that doesn’t just respond, it understands, learns, and adjusts.
Most AI assistants answer questions.
But an agent should:
- Observe the world
- Reason over context
- Reflect on past behavior
- Adapt its strategy
- Take actions (like scheduling your focus block)
Focus Buddy v4.0 now does all of this.
Your agent now consults two external sources before planning:
Finds your free focus slots automatically.
Looks at your top pending tasks and includes them in the reasoning.
Both mocks are designed with the same interfaces real MCP servers use.
Swapping them with Google Calendar / Notion / Todoist MCP will require zero changes to your agent logic.
Focus Buddy uses:
- Your goal
- Your available duration
- Calendar free slots
- Pending tasks
- Your average focus time
- Fatigue trends
- Break frequency
…and merges everything into a personalized plan.
With a single toggle (auto_schedule=True):
- The agent picks your next free slot
- Adds a calendar event via MCP
- Returns the scheduled confirmation
This turns planning into doing.
Stored per-session:
- Focus time
- Fatigue score
- Breaks taken
- Reflections
- Timestamp
This historical memory directly influences:
- Block length
- Break timing
- Realism adjustments
- Reflection insights
[User Goal + Duration]
↓
[MCP Context Agent]
↓
[Classifier → focus / research / motivation]
↓
[Router]
├── Planner Agent (uses memory + context)
├── Research Agent
└── Motivation Agent
↓
[Reflection Agent]
↓
[Memory Save]
↓
[User Feedback → Memory Update]
git clone https://github.com/serasr/agentic-focus-buddy.git
cd agentic-focus-buddypython -m venv .venv
# Activate it:
venv\Scripts\activate # Windows
source .venv/bin/activate # macOS/Linuxpip install -r requirements.txtCreate a .env file in the project root:
OPENAI_API_KEY=sk-your-key-hereIf you’re using Agentic RAG:
SERPAPI_API_KEY=your-serpapi-keypython app.pyThen open:
http://127.0.0.1:7860focus-buddy-agent/
├─ focus_buddy_langgraph.py # LangGraph agent (context, memory, reflection)
├─ focus_buddy_rag.py # Retrieval pipeline (SerpAPI-based)
├─ focus_buddy.py # Simple agent
├─ memory_manager.py # Memory handler
├── mcp_client.py # MCP-style mock servers (calendar + tasks)
├─ app.py # Gradio web UI
├─ sample_focus_memory.json # Sample file depicting how memory is stored locally. This file will be created when the app is run.
├── calendar_data.json # Calendar mock data
├── tasks_data.json # Tasks mock data
├─ requirements.txt
├─ .env
├─ end-product/
│ └─ v4/ # Screenshots or demo outputs
├─ README.md
└─ CHANGELOG.md
- LangGraph – workflow and routing
- OpenAI GPT‑4o-mini – reasoning & planning
- Gradio – UI
- dotenv – environment loading
- Local MCP mocks – calendar + tasks
- JSON-based memory system – behavior tracking
See requirements.txt
Most AI apps react to input once and stop.
Focus Buddy thinks, routes, retrieves, acts, and reflects - following the Reason → Act → Reflect pattern that defines agentic systems.
It’s a small example of how agents can move from reactive tools → autonomous collaborators.
Created by: Sera
Part of the Agentic AI Learning-in-Public series; building reasoning-driven systems that bridge productivity, autonomy, and AI design.