A Meeting Scheduler with Ceylon - Multi Agent System

Dewmal
CeylonAI
Published in
4 min readJul 20, 2024

This tutorial explains a basic meeting scheduler program that helps find a suitable time slot for a meeting among multiple participants.

What Does This Program Do?

  1. It tries to schedule a meeting for a specific date.
  2. It checks the availability of multiple participants.
  3. It finds a time slot where enough people are available.

Main Components

  1. Meeting: Represents the meeting to be scheduled.
  2. TimeSlot: Represents a specific time period on a date.
  3. Participant: Represents a person with their available time slots.
  4. Coordinator: Manages the scheduling process.

How It Works

  1. The Coordinator starts with a meeting request.
  2. It asks all participants about their availability for different time slots.
  3. Participants respond with whether they’re available or not.
  4. The Coordinator keeps track of who’s available for each time slot.
  5. When enough people are available for a time slot, it schedules the meeting.

Example Scenario

Let’s say we want to schedule a 2-hour meeting on July 21, 2024, with at least 3 participants.

We have 5 participants:

  • Alice
  • Bob
  • Charlie
  • David
  • Kevin

Each participant has their own availability:

  • Alice: 9 AM — 12 PM, 2 PM — 6 PM
  • Bob: 10 AM — 1 PM, 3 PM — 5 PM
  • Charlie: 11 AM — 2 PM, 4 PM — 6 PM
  • David: 11 AM — 2 PM, 4 PM — 6 PM
  • Kevin: 10 AM — 1 PM, 3 PM — 5 PM

The program will check different time slots and find one where at least 3 people are available for 2 hours.

Code Explanation

Colab — https://colab.research.google.com/drive/1C-E9BN992k5sZYeJWnVrsWA5_ryaaT8m?usp=sharing

Result

Data Classes

Meeting

@dataclass(repr=True)
class Meeting:
name: str
date: str
duration: int
minimum_participants: int

This class represents a meeting with its name, date, duration, and the minimum number of participants required.

TimeSlot

@dataclass(repr=True)
class TimeSlot:
date: str
start_time: int
end_time: int
@property
def duration(self):
return self.end_time - self.start_time

This class represents a time slot with a date, start time, and end time. It also has a duration property.

AvailabilityRequest and AvailabilityResponse

These classes are used for communication between the Coordinator and Participants.

Participant Class

class Participant(Worker):
name: str
available_times: List[TimeSlot]

async def on_message(self, agent_id: "str", data: "bytes", time: "int"):
# Check availability and respond
  • Represents a participant with a name and list of available time slots.
  • The on_message method is called when the participant receives an availability request.
  • It checks if the requested time slot overlaps with any of their available times and responds accordingly.

Coordinator Class

class Coordinator(Admin):
meeting: Meeting = None
agreed_slots = {}
next_time_slot = None
async def run(self, inputs: "bytes"):
# Initialize the meeting
async def on_agent_connected(self, topic: "str", agent_id: "str"):
# Start the scheduling process when an agent connects
async def on_message(self, agent_id: "str", data: "bytes", time: "int"):
# Process availability responses and schedule next time slot
  • Manages the overall scheduling process.
  • Keeps track of the meeting, agreed time slots, and the next time slot to check.
  • The run method initializes the meeting.
  • on_agent_connected starts the scheduling process when a participant connects.
  • on_message processes availability responses from participants and schedules the next time slot to check if needed.

Main Function

async def main():
# Create participants
agent1 = Participant("Alice", [TimeSlot("2024-07-21", 9, 12), TimeSlot("2024-07-21", 14, 18)])
agent2 = Participant("Bob", [TimeSlot("2024-07-21", 10, 13), TimeSlot("2024-07-21", 15, 17)])
# ... more participants ...
coordinator = Coordinator()
await coordinator.run_admin(
inputs=Meeting(name="Meeting 1", duration=2, date="2024-07-21", minimum_participants=3),
workers=[agent1, agent2, agent3, agent4, agent5]
)
  • Creates participant instances with their available time slots.
  • Creates a Coordinator instance.
  • Runs the scheduling process with a specific meeting request and list of participants.

Key Points and Takeaways

Technical Aspects

  1. Asynchronous Programming: The code uses async/await for efficient handling of multiple participants, allowing for concurrent processing of availability checks.
  2. Ceylon Library: The program utilizes the ceylon library to manage the workspace and facilitate communication between agents (participants and coordinator).
  3. Sequential Time Slot Checking: The scheduling algorithm checks time slots one by one, moving to the next slot if the current one doesn’t have enough available participants.
  4. Termination Condition: The program stops when it finds a time slot with enough available participants, optimizing the search process.
  5. Distributed System: This code demonstrates a basic implementation of a distributed scheduling system, where multiple agents (participants) collaborate to find a suitable meeting time.

Functional Aspects

  1. Automation: The program automates the process of finding a suitable meeting time, reducing manual effort and potential conflicts.
  2. Comprehensive Availability Check: It considers everyone’s availability to ensure maximum participation, increasing the likelihood of finding an optimal time slot.
  3. Flexibility: The system is designed to work with different meeting durations and participant requirements, making it adaptable to various scheduling scenarios.
  4. Real-world Problem Solving: This program showcases how the Ceylon Multi-Agent System can efficiently solve real-world scheduling problems, demonstrating practical applications of multi-agent systems.
  5. Scalability: The use of asynchronous programming and the Ceylon library allows the system to potentially handle a large number of participants efficiently.

Overall Impact

This Meeting Scheduler serves as an excellent example of how multi-agent systems, particularly those built with the Ceylon framework, can be applied to solve common organizational challenges. By automating the scheduling process and considering multiple constraints (participant availability, meeting duration, minimum attendance), it significantly reduces the time and effort required to coordinate meetings, especially for large groups or complex schedules.

The program’s flexibility and efficiency demonstrate the potential of multi-agent systems in optimizing various types of coordination and decision-making processes in real-world scenarios.

--

--