This project implements a movie ticket booking system using AI agents. It allows users to book and unbook movie tickets as well as view the movie schedule. The system comprises a theater agent that manages the movie schedule and a user agent that interacts with the user to book or unbook tickets.
-
Clone the repository:
git clone https://github.com/devcode8/movie-booking.git cd movie-booking
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the theater agent:
python movie_theater.py
-
Copy the movie_theater agent address to user agent:
THEATER_AGENT_ADDRESS = "agent1q22q78dcc8twwk4gfqqql9za8ae5wsx2ednqccdfrp74mx25g4tz62geqxv"
-
In a separate terminal, start the user agent:
python user.py
-
Follow the on-screen prompts to interact with the system.
The protocols define the structure of the messages exchanged between the user and theater agents.
QueryScheduleRequest
andQueryScheduleResponse
: Used to request and respond with the current movie schedule.BookTicketRequest
andBookTicketResponse
: Used to book a ticket for a specified movie and time.UnbookTicketRequest
andUnbookTicketResponse
: Used to unbook a previously booked ticket.
The theater agent (movie_theater.py
) manages the movie schedule and handles booking and unbooking requests.
The user agent (user.py
) interacts with the user to facilitate booking and unbooking tickets and viewing the schedule.
-
Theater Agent:
The theater agent initializes with a predefined movie schedule and listens for requests from the user agent.
python movie_theater.py
-
User Agent:
The user agent presents a menu to the user, allowing them to book tickets, unbook tickets, or view the schedule.
python user.py
-
The user agent presents a menu:
What would you like to do? 1. Book a movie ticket 2. Unbook a movie ticket 3. Display movie schedule 4. Exit Enter the number of your choice:
-
The user chooses to book a ticket (
1
). -
The user enters the movie name and preferred show time.
-
The system attempts to book the ticket and notifies the user of the success or failure.
-
The user agent presents a menu:
What would you like to do? 1. Book a movie ticket 2. Unbook a movie ticket 3. Display movie schedule 4. Exit Enter the number of your choice:
-
The user chooses to unbook a ticket (
2
). -
The user enters the movie name and show time.
-
The system attempts to unbook the ticket and notifies the user of the success or failure.
-
The user agent presents a menu:
What would you like to do? 1. Book a movie ticket 2. Unbook a movie ticket 3. Display movie schedule 4. Exit Enter the number of your choice:
-
The user chooses to view the schedule (
3
). -
The system displays the current movie schedule with available seats for each time slot.
-
The user agent presents a menu:
What would you like to do? 1. Book a movie ticket 2. Unbook a movie ticket 3. Display movie schedule 4. Exit Enter the number of your choice:
-
The user chooses to exit (
4
). -
The user agent stops running.