Barcelona Code School

Since 2015 / 500+ graduates

How to Build an AI Membership and Class Booking Agent for a Gym

Build a gym booking agent as a conversational layer over the gym’s authoritative membership and scheduling system. Let AI understand the member’s request and collect missing details; let deterministic tools verify identity, membership eligibility, live class capacity, booking windows and cancellation policy. Confirm every state-changing action from the booking system, use idempotency to prevent duplicates and send policy disputes, health questions and unresolved errors to staff.

Key takeaways

  • The scheduling platform, not the model, owns membership status, capacity, waitlist position and booking state.
  • Availability must be checked again immediately before committing a booking.
  • Booking, cancellation and waitlist actions need explicit member confirmation and idempotency.
  • The agent may route accessibility or health-related questions but must not give medical or exercise advice.
  • Success is a verified state change or a clear staff handoff, never a confident message without a booking receipt.

What business workflow does this agent own?

This agent handles a narrow front-desk workflow: answer approved membership and class-policy questions, find suitable classes, verify whether the identified member may book, create or cancel a reservation, join a waitlist and send a confirmation. It can also collect a prospective member’s contact details for staff follow-up with appropriate notice and consent.

It does not create membership contracts, set prices, waive fees, take payment, override age or access rules, change class capacity, recommend exercise for a medical condition or decide whether a person is fit to participate. Those actions remain with authorised staff and existing business systems.

Capacity-aware booking state machine

From request to confirmed system state

Accessible text equivalent: the agent extracts the request, verifies the member and relevant policy, checks live capacity, asks for confirmation, commits one authorised state change, verifies the booking-system receipt, then notifies the member or escalates unresolved cases.

Business boundary and permissions

ActionAgent mayRequired controlNever autonomous
Membership questionsAnswer from approved current policyCitation/version and staff routeInvent price, contract term or exception
Class discoveryRead timetable, location and public descriptionFresh read from source systemPromise availability from cached text
Book or waitlistCall authorised booking toolVerified identity, eligibility, confirmation, idempotencyOverride capacity or membership restriction
CancelCancel eligible member bookingShow applicable policy before confirmationWaive fee or change policy
Health/accessibilityCollect minimal routing note and contact staffExplicit purpose, restricted accessMedical, rehabilitation or personalised exercise advice
Payment/contractProvide approved link or staff handoffAuthoritative checkout/CRMCharge card, sign contract or change plan

Input and output data schema

FieldTypeRequiredRule
request_idstringYesUnique idempotency key for the conversation action
intentenumYesmembership_question, find_class, book, waitlist, cancel, human_help
member_referencetoken/stringFor member actionUse verified identifier; do not expose full profile in model context
club_idstringFor scheduleMust match authoritative location
class_idstringFor state changeSelected from fresh schedule result
requested_timeISO datetime + timezoneFor discoveryNormalise and repeat visibly to member
member_confirmedbooleanFor writeTrue only after showing exact class/action/policy
result_statusenumOutputconfirmed, waitlisted, cancelled, no_capacity, ineligible, needs_human, failed
booking_referencestring/nullOn successReturned by source system, never model-generated
staff_reasonenum/nullOn handoffpolicy_dispute, health_question, identity_failure, system_error, other

How to build the workflow

  1. Choose the authoritative systems. Name the membership database, timetable/booking platform, policy source and support queue. Do not create a parallel capacity count in the AI workflow.
  2. Define intents and stopping conditions. Limit the first version to membership FAQs, discovery, booking, waitlist and cancellation. Stop on identity mismatch, unsupported policy exception or repeated tool failure.
  3. Create narrow read tools. Separate member eligibility, class search, live capacity, existing booking and cancellation-policy reads. Return typed results and freshness timestamps.
  4. Design confirmation. Before any write, show club, class, instructor if relevant, local date/time, booking or cancellation action and applicable rule. Require an explicit yes.
  5. Create idempotent write tools. The booking platform receives request_id, verified member and class. Repeating the same request must return the existing result rather than create another booking.
  6. Add waitlist logic. Join only if the platform reports no capacity and the member confirms. Never invent a waitlist position or promotion time.
  7. Add privacy and staff routes. Minimise member data in prompts and logs. Route contract disputes, sensitive health/accessibility notes and unresolved identity to an authorised person.
  8. Test and monitor. Run the matrix below, verify final system state, track error categories and alert staff when the booking source is unavailable.

Normal, error and escalation paths

PathTriggerSystem behaviourMember message
Normal bookingEligible member, space available, confirmedWrite once, read receipt, store audit eventConfirmed class details and booking reference
WaitlistClass full, waitlist open, confirmedCreate waitlist entry and verify resultWaitlist status from source; no promise of place
IneligiblePlan/location/booking-window rule blocksNo write; show approved reason or staff routeConcrete rule and next option
Race conditionSpace disappears before writeReturn no_capacity; offer waitlist/alternativesExplain capacity changed; do not claim booking
Tool failureTimeout or malformed responseRetry bounded read; no blind write; open staff taskBooking not confirmed; staff will review
Policy/health disputeException or advice requestStop automation and restrict handoff dataStaff contact/handoff, no advice or exception

Test matrix before launch

TestExpected outcomePass evidence
One available placeOne booking after explicit confirmationSingle source-system receipt and audit event
Two simultaneous requests for final placeOnly source-authorised result succeedsNo over-capacity; loser gets waitlist/alternative
Repeated webhook/messageNo duplicate bookingSame idempotency result returned
Membership not eligibleNo write and correct staff/policy routeTool decision, not model invention
Cancellation after cutoffNo autonomous waiverPolicy displayed and staff escalation offered
Booking API timeoutNo success messageFailed/pending state and staff alert
Health advice requestNo medical or exercise recommendationSafe boundary plus qualified staff/professional route
Unverified identityNo member data or state change exposedAuthentication request or human handoff
Launch success criteria: zero over-capacity or duplicate bookings in the acceptance suite; every success has an authoritative receipt; every state change has confirmation and audit evidence; unsupported, health-related and policy-exception cases stop and reach the correct person.

Privacy and data retention

Gym bookings use personal data and may reveal routines. Under GDPR principles, the gym should state the purpose, collect only what is necessary, keep it accurate, restrict access and define retention. Do not copy full member profiles into the model prompt or retain free-form conversation by default.

Health information can receive special protection. The safer first version does not collect diagnoses or infer fitness. If a member volunteers sensitive information, minimise it, do not use it for advice and transfer the case through an approved restricted channel.

Learn to build the whole controlled workflow

This gym example is one industry-specific workflow. For the reusable build process, see the general BCS agent guide.

Barcelona Code School’s AI Agent & Automation Bootcamp teaches n8n, shared data, tools, RAG, approvals, QA, orchestration and monitoring through connected business systems. The programme runs for four weeks / 160 hours, full-time, on campus or remote live. Tuition is €3,600. It prepares portfolio evidence; it does not guarantee employment.

See the AI Automation Bootcamp

Frequently asked questions

Can an AI agent book gym classes automatically?

It can complete a booking after verified identity, eligibility, live capacity and explicit member confirmation. The booking platform must return the final receipt. The model should never invent availability or confirmation.

How should the agent handle a full class?

It should read the current waitlist policy, offer the waitlist or alternative classes and create a waitlist entry only after confirmation. It must not promise a place or promotion time unless the source system provides it.

Can the agent cancel a booking?

Yes when the verified member requests it and the authoritative policy permits the action. The agent should show relevant cutoff or fee information before confirmation and escalate exception or waiver requests to staff.

Should the gym agent give workout or health advice?

No. This workflow is for membership information and booking operations. Medical, rehabilitation, injury and personalised exercise questions should go to an appropriately qualified person under the gym’s policy.

What systems does a gym booking agent need?

It needs approved access to membership eligibility, the live timetable and capacity, booking/waitlist/cancellation tools, current policy content, a notification channel, an audit log and a staff-support queue.

How do you prevent duplicate or over-capacity bookings?

Use an idempotency key for every action, recheck live capacity before the write, let the booking platform enforce capacity atomically and verify the returned final state before sending confirmation.

Sources

  1. EUR-Lex: General Data Protection Regulation, Article 5.
  2. European Commission: principles of GDPR.
  3. n8n documentation: error handling.
  4. n8n documentation: human fallback for AI workflows.
  5. BCS: How to build an AI agent.
  6. BCS AI Agent & Automation Bootcamp.
Back to posts