A stateful AI study planning application built on Cloudflare Agents. The system generates personalized study plans, persists the latest plan using Durable Objects, supports context-aware plan refinement across conversations, streams responses in real time, and schedules study tasks through workflow-style tool execution.
Designed to simulate how real-world AI assistants manage evolving user context and long-running workflows.
Most AI applications today are stateless — they lose context across interactions.
This project demonstrates how to build a stateful AI system at the edge, where:
- user context persists across sessions
- plans can be incrementally refined
- tasks can be scheduled and executed asynchronously
- Conversational study planning using Workers AI (LLM)
- Persistent memory using Durable Objects
- Iterative plan refinement (context-aware updates)
- Task scheduling and execution (workflow support)
- Real-time streaming chat UI
- Stateful Plan Memory (WOW factor):
- Stores the latest study plan in agent state
- Allows retrieval via natural language ("What’s my current plan?")
- Enables structured plan evolution across multiple turns
Unlike traditional chat-based apps, this system persists the latest generated plan explicitly in agent state.
This enables:
- retrieving the current plan at any time
- updating plans incrementally
- maintaining continuity across interactions
Example: User: Make me a plan → Plan generated
User: Make Wednesday lighter → Plan updated
User: What’s my current plan? → Retrieved from persistent state
User → Pages UI → Agent (Durable Object) → Workers AI ↳ Persistent State (latestPlan) ↳ Scheduling (tasks/workflows)
- User: “I have an exam in 5 days…”
- Agent generates structured study plan
- User: “Make Wednesday lighter”
- Agent revises plan using memory
- User: “What’s my current plan?”
- Agent retrieves plan from persistent state
- User: “Remind me tomorrow at 9 AM”
- Agent schedules task using workflow
- Cloudflare Agents (stateful AI agents)
- Durable Objects (persistent memory)
- Workers AI (LLM inference at the edge)
- Vite + React (frontend)
- Zod (tool validation)
- AI SDK (streaming + tool execution)
- Stateful agent design using Durable Objects
- Tool-based LLM interaction (getCurrentPlan, scheduleTask)
- Context pruning for efficient inference
- Separation of conversational memory vs persistent state
- Event-driven workflow execution (scheduled tasks)
This project leverages Cloudflare’s edge-native architecture:
- Durable Objects → stateful agents
- Workers AI → low-latency inference
- Built-in scheduling → long-running workflows
It demonstrates how AI systems can evolve from:
stateless APIs → persistent, interactive agents at the edge
Clone the repository:
git clone git@github.com:ShireenMeher/cf_ai_study_planner.gitNavigate into the project directory
cd cf-ai-study-plannerInstall dependencies
npm installStart the development server
npm run devOpen in browser
Visit: http://localhost:5173
Here is a link where you can access the agent live:
https://cf-ai-study-planner.shireenmeher296.workers.dev
- Plan versioning (compare old vs new)
- Recurring schedules (daily study reminders)
- Browser notifications for reminders
- Multi-user plan isolation
This project demonstrates how to build production-style AI systems, not just chatbots — combining:
- memory
- workflows
- tool usage
- and edge-native execution
into a cohesive, stateful experience.


