📥 User Input → 🎯 Orchestrator Agent
├── 1. Get Current Time Context
├── 2. Classify Intent
├── 3. Route to Specialist Agent
└── 4. Return Final Result
User: "Schedule meeting tomorrow at 2 PM"
1. 🕒 GET TIME CONTEXT
├── GetCurrentTime() → Current: 2025-07-25 12:45 PM
└── GetDateRange("tomorrow") → 2025-07-26 00:00 to 23:59
2. 📝 PARSE SCHEDULE REQUEST
├── Extract: title, datetime, duration, priority
└── Convert "tomorrow 2 PM" → "2025-07-26T14:00:00+05:30"
3. 🔍 CHECK AVAILABILITY
├── GetFilteredCalendarEvents(2025-07-26 date range)
└── Detect conflicts at requested time
4. ⚖️ RESOLVE CONFLICTS (if any)
├── High priority: Move existing events
├── Low priority: Find alternative slots
└── No conflicts: Proceed with original time
5. ✅ CREATE EVENT
├── CreateCalendarEvent with resolved time
└── Return success with event details
User: "Move today's 3 PM meeting to tomorrow"
1. 🕒 GET TIME CONTEXT
├── GetCurrentTime() → Current: 2025-07-25
├── GetDateRange("today") → 2025-07-25 range
└── GetDateRange("tomorrow") → 2025-07-26 range
2. 🔍 IDENTIFY TARGET EVENT
├── GetFilteredCalendarEvents(today's range)
├── Find event at 3 PM today
└── Extract event_id
3. 📅 FIND NEW SLOT
├── GetFilteredCalendarEvents(tomorrow's range)
├── Find free slots for tomorrow
└── Select best available time
4. 🔄 RESCHEDULE EVENT
├── RescheduleCalendarEvent(event_id, new_time)
└── Return success confirmation
User: "Show me my events for this week"
1. 🕒 GET TIME CONTEXT
├── GetCurrentTime() → Current: 2025-07-25
└── GetDateRange("this_week") → 2025-07-21 to 2025-07-27
2. 📊 RETRIEVE FILTERED EVENTS
├── GetFilteredCalendarEvents(week range)
└── Filter events by date range
3. 📈 ANALYZE & FORMAT
├── Group events by day
├── Identify patterns/conflicts
├── Calculate free time
└── Format user-friendly response
4. 📤 RETURN ANALYSIS
└── Formatted calendar view with insights
def enhanced_orchestrator(state):
# ALWAYS get time context first
current_time = get_current_time_tool.func()
# Classify with time awareness
intent = classify_intent_with_time_context(state.user_input, current_time)
# Route to specialist with time context
return route_with_time_context(state, intent, current_time)def enhanced_scheduler_flow(state):
# Step 1: Time Context
time_context = get_current_time_tool.func()
# Step 2: Parse with time awareness
parsed = parse_with_time_context(state.user_input, time_context)
# Step 3: Get relevant events only
if parsed.get("target_date"):
events = get_filtered_calendar_events_tool.func({
"start_date": parsed["target_date"] + "T00:00:00+05:30",
"end_date": parsed["target_date"] + "T23:59:59+05:30"
})
# Step 4: Smart conflict resolution
# Step 5: Create eventdef enhanced_analyzer_flow(state):
# Step 1: Extract time expression
time_expr = extract_time_expression(state.user_input)
# Step 2: Get date range
date_range = get_date_range_tool.func({"time_expression": time_expr})
# Step 3: Get filtered events
events = get_filtered_calendar_events_tool.func({
"start_date": date_range["start_date"],
"end_date": date_range["end_date"]
})
# Step 4: Analyze and format
return format_calendar_analysis(events, time_expr)- ✅ Add time tools to multi-agent system (DONE)
- 🔧 Update Analyzer Agent to use filtered events
- 🔧 Fix Scheduler Agent to use time context
- 🔧 Enhance Orchestrator with time awareness
- 🔧 Improve Reschedule Agent flow
- 🔧 Add better conflict resolution
- 🔧 Add session persistence
- 🔧 Add calendar insights/analytics
- 🔧 Add natural language improvements
- 🔧 Add multi-user support
User: "What meetings do I have today?"
🎯 Orchestrator:
- GetCurrentTime() → July 25, 2025
- Classify: "analyze" intent
- Route to: Analyzer Agent
📊 Analyzer Agent:
- GetDateRange("today") → 2025-07-25 range
- GetFilteredCalendarEvents(today's range) → 2 events
- Format response: "You have 2 events today..."
✅ Result: Shows only TODAY's events (not old 2024 events)
This enhanced flow ensures:
- ✅ Proper time awareness
- ✅ Accurate date filtering
- ✅ Better user experience
- ✅ No confusion with old events
- ✅ Consistent behavior across all agents