An open-source solution for Google Calendar integration of your pet care routines and preferences.
Click the thumbnail below to watch LEASH in action...
![]()
This project integrates multiple services to provide AI-powered pet care calendar suggestions using local LLM models.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Email Server │ │ Agent Server │
│ (React/Vite) │ │ (FastAPI) │ │ (FastAPI) │
│ Port: 5173 │ │ Port: 5001 │ │ Port: 5002 │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Profiles │ │ Google Calendar │ │ Ollama LLM │
│ (Static JSON) │ │ API │ │ (Local Host) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
- Ollama - Install from https://ollama.ai
- Node.js - For the frontend
- Python 3.11+ - For backend services
- Google Calendar API - Setup required for email server
# Install a model
# ollama pull llama3.2
ollama pull mistral
# Start Ollama service
ollama servecd project/agent_server
conda create -n agent_server python=3.11
conda activate agent_server
pip install -r requirements.txt
python server.py
# Runs on http://localhost:5002cd project/email_server
conda create -n email_server python=3.11
conda activate email_server
pip install -r requirements.txt
python server.py
# Runs on http://localhost:5001cd project/frontend
npm install
npm run dev
# Runs on http://localhost:5173- Open the app at
http://localhost:5173 - Login to authenticate with Google Calendar
- Navigate to any day in the calendar view
- Click "Schedule Dog Care" button
- Review AI suggestions in the modal popup
- Accept or reject individual suggestions
- Accepted events are automatically added to your Google Calendar
- Data Collection: The frontend loads pet and owner profiles from
public/profiles/ - Context Building: Current calendar events and profile data are combined
- AI Generation: Agent server uses Ollama LLM to generate personalized suggestions
- Event Creation: Accepted suggestions are added to Google Calendar via email server
project/
├── agent_server/ # AI service for calendar suggestions
│ ├── api/ # Swagger documentation
│ ├── app/ # FastAPI application
│ │ ├── router/ # API endpoints
│ │ └── services/ # Ollama integration
│ ├── models/ # Pydantic models
│ └── server.py # Main server
├── email_server/ # Google Calendar integration
│ ├── app/ # FastAPI application
│ │ ├── auth/ # OAuth & session management
│ │ ├── router/ # API endpoints
│ │ └── services/ # Google Calendar API
│ └── server.py # Main server
└── frontend/ # React application
├── public/profiles/ # User and pet profiles
├── src/components/ # React components
└── src/services/ # API integration
- Local LLM Integration: Uses Ollama for privacy-first AI
- Custom System Prompts: Tailored prompts for pet care scheduling
- Multiple Model Support: Works with llama3.2, mistral, etc.
- Intelligent Suggestions: Considers pet needs, owner schedule, existing events
- Profile Management: JSON-based pet and owner profiles
- Interactive UI: Modal-based suggestion review
- Real-time Updates: Calendar refreshes after accepting suggestions
- Error Handling: Graceful fallbacks for service issues
- Google Calendar API: Full read/write access to calendar
- OAuth Authentication: Secure Google login
- Event Validation: Prevents scheduling conflicts
- Bulk Operations: Efficient event creation
{
"pets": [
{
"name": "Luna",
"age": "4 years",
"breed": "Border Collie",
"weight": "45 lbs",
"walk-time-per-day": "90 minutes",
"energy-level": "high",
"current_medications": [...],
"behavioral-notes": "Highly intelligent, needs mental stimulation"
}
]
}{
"userDetails": [
{
"name": "Your Name",
"email": "your.email@gmail.com",
"yard-access": true,
"preferred-walk-times": ["early morning", "late evening"],
"exercise-level": "high"
}
]
}The agent server creates dynamic system prompts that include:
- Pet Details: Breed, age, energy level, medications, special needs
- Owner Context: Schedule, preferences, yard access, work hours
- Calendar Analysis: Current events to avoid conflicts
- Activity Types: Walks, feeding, medication, play, grooming, training
POST /leash-daily-calendar-fill- Generate calendar suggestionsGET /health- Service health checkGET /models- List available Ollama modelsPOST /query- General LLM queries
POST /calendar/events- Create calendar eventsGET /calendar/events- Get events for dateGET /auth/status- Check authentication statusGET /auth/login- Google OAuth login
Agent Server Not Responding
- Ensure Ollama is running:
ollama serve - Check if model is available:
ollama list - Verify port 5002 is free
Calendar Events Not Creating
- Check Google Calendar authentication
- Verify email server is running on port 5001
- Check browser console for API errors
Profile Data Not Loading
- Ensure profiles are in
frontend/public/profiles/ - Check JSON file formatting
- Verify frontend dev server is serving static files
- Frontend: Check browser console for detailed logs
- Agent Server: Visit
http://localhost:5002for Swagger UI - Email Server: Check server logs for authentication issues
# Test basic connectivity
curl http://localhost:5002/health
# Test LLM query
curl -X POST http://localhost:5002/query \
-H "Content-Type: application/json" \
-d '{"query": "Hello!", "model": "llama3.2"}'- New Activity Types: Update system prompt in
ollama_service.py - Profile Fields: Modify JSON structure and conversion logic
- UI Enhancements: Add components to
frontend/src/components/
This project is for the Microsoft Senior Applied Scientist application demonstration.
- Calendar template system
- Accident prediction network ;)