An AI-powered course scheduling assistant for Cornell University students. Built with Cloudflare Workers, D1, Vectorize, and Workers AI.
Access at: Here!
- Semantic Course Search - Natural language search powered by Cloudflare Vectorize embeddings
- Visual Calendar - Schedule visualization
- Conflict Detection - Automatic detection of time conflicts between courses
- Advanced Filtering - Search by subject, credits, instructor, distribution requirements, and more
- AI Chat Interface - Natural conversation with GPT-4 for course recommendations =- Real-time Updates - Streaming AI responses and instant schedule updates
- Frontend: React + Vite + TypeScript
- Backend: Cloudflare Workers + Durable Objects
- Database: Cloudflare D1 (SQLite)
- Vector Search: Cloudflare Vectorize
- AI: Workers AI + OpenAI GPT-4
- Deployment: Cloudflare Pages/Workers
- Cloudflare account with Workers subscription
- OpenAI API key
- Node.js 18+ and npm
- Cornell Course Roster Information
git clone <your-repo-url>
cd course-agent
npm installCreate a .dev.vars file:
OPENAI_API_KEY=your_openai_api_key_here# Login to Cloudflare
npx wrangler login
# Create D1 database
npx wrangler d1 create cornell-courses-db
# Create Vectorize index (768 dimensions for bge-base-en-v1.5)
npx wrangler vectorize create cornell-courses --dimensions=768 --metric=cosineUpdate wrangler.jsonc with your database ID from the output above.
npx wrangler d1 execute cornell-courses-db --local --file=./schema.sqlAdd your Cornell course data to flattened_sections.json (see data format below), then:
node scripts/upload-courses.jsThis script will:
- Parse course data from JSON
- Generate embeddings using Workers AI
- Upload to D1 and Vectorize
npm startThe application uses two main tables:
Stores course information including:
- Course metadata (subject, catalog number, title, credits)
- Meeting times, instructors, location
- Distribution requirements, grading basis
- Text embeddings for semantic search
Stores user's selected courses:
- User ID (from Durable Object)
- Course ID reference
- Optional notes
- Timestamp
The ingestion script expects JSON in this format:
[
{
"subject": "CS",
"catalogNbr": "2110",
"titleLong": "Object-Oriented Programming and Data Structures",
"credits": 4,
"meetings": ["MW 10:10AM-11:25AM", "TR 02:55PM-04:10PM"],
"instructors": "Foster, Muhlberger",
"component": "LEC",
"location": "Olin Hall 155",
"acadCareer": "UG",
"acadGroup": "EN",
"grading": "GRD",
"attributes": ["MQR-AS"],
"enrollGroups": [...]
}
]The chat agent has access to these tools:
- searchCourses - Semantic search using natural language
- advancedCourseSearch - Filter by subject, credits, instructor, etc.
- getCourseDetails - Get detailed info about a specific course
- addCourseToSchedule - Add course to user's schedule (with conflict detection)
- viewMySchedule - Display schedule with visual calendar
- removeCourseFromSchedule - Remove course from schedule
- checkScheduleConflicts - Check for time conflicts
- User query β Workers AI (bge-base-en-v1.5) β Query embedding
- Vectorize similarity search β Top K course IDs
- D1 lookup β Full course details
- Return results to AI
- User selects course via chat
- Tool adds to
user_schedulestable - Conflict detection runs against existing courses
- Visual calendar generated as SVG
- SVG uploaded to tempfile.org
- Markdown image returned to user
- Each browser session gets a unique Durable Object ID
- Schedules persist per session (not across browser refreshes)
- To add persistent users, implement localStorage-based user IDs
Try these example queries with the AI assistant:
"Find machine learning courses"
"Show me CS classes about algorithms"
"What intro programming courses are available?"
"Search for courses with Professor Foster"
"Find 3-credit classes on Tuesdays and Thursdays"
"Show me courses that fulfill the MQR distribution requirement"
"Tell me more about CS 2110"
"What are the meeting times for MATH 1920?"
"Who teaches INFO 1998?"
"Show me all sections of CS 3110"
"Add CS 2110 to my schedule"
"Show my schedule"
"What classes am I taking?"
"Remove MATH 1920 from my schedule"
"Check my schedule for conflicts"
"Add the course we just discussed"
"Find 4-credit CS courses"
"Show me classes that meet on Monday and Wednesday"
"What courses are taught by Muhlberger?"
"Find upper-level MATH courses"
"Show me seminars in the Engineering college"
"I need a programming class for beginners"
"What's a good follow-up to CS 1110?"
"Help me find an easy 3-credit elective"
"I'm interested in AI and data science, what should I take?"
"Can you recommend courses for a CS major?"
- Built with Cloudflare Agents and the Cloudflare Agents Starter Kit
- Course data from Cornell University Class Roster API