AI executive agent autonomously navigating a booking website to schedule appointments
AIAutomationTechnology

I Built an AI Agent That Books My Haircut

Why barber booking flows are deceptively hard for AI agents: multi-step navigation, calendar checks, and real scheduling with Claude Code and Playwright.

JM

Jason Macht

Founder @ White Space

January 12, 2026 · Updated May 26, 2026
13 min read

I was three weeks overdue for a haircut. Booking one is a 15-minute job: pull up my calendar, check the barber's website, find an open slot, book it. It kept sliding down the list because something more urgent always came up.

So I built an AI agent to do it for me.

The agent checks my Google Calendar, works through my barber's booking website with Playwright, and schedules the appointment end-to-end from one command.

Yes, it's overkill for a haircut. I still think life admin is the best place to practice with AI agents, because it's repetitive, it follows rules, and it's way more annoying than it is important. Once you've built the pattern for one task, you can reuse it everywhere.

What did I give the agent to start?

Before the agent could do anything, it needed context and constraints. I wrote it a short brief covering:

  • The barbershop and the URL of their booking portal
  • Who I normally see, with "anyone available" as the fallback
  • My time constraints: weekday mornings before 10am, no Mondays at all, and at least 2 days' notice
  • Google Calendar read access, so it could check my availability
  • Booking site credentials, stored in environment variables and never pasted into prompts
  • My payment card, which was already saved on the site, so I didn't have to hand over any new payment details

I also set an approval boundary. The agent could complete the booking, but anything that created a commitment or cost money needed my final confirmation first.

Setup took maybe 5 minutes. The constraints matter most: the clearer you are about preferences up front, the less back-and-forth you have with the agent later.

Which tools did I use?

Three pieces made this work.

Claude Code is the orchestrator. It plans the approach, writes the code, handles errors and iterates, and it coordinates everything else.

The Google Calendar integration tells the agent when I'm actually free. There's no point booking an 8am haircut when I have a client call.

Playwright handles the browser. The agent moves through the booking website like a real user would, clicking, filling forms and picking options. Most booking systems don't have APIs, so a browser is how you get this done.

The agent runs a workflow across all three systems, which is a bigger job than a chatbot answering questions.

How did the booking actually work?

Step 1: check the calendar

I started with a simple prompt:

"Book me a haircut at [shop name] sometime this week. Here's their booking site: [URL]. Check my calendar first and find times that work. I prefer morning slots before 10am, no Mondays."

The agent connected to my Google Calendar and pulled my upcoming events. Tuesday, Wednesday and Thursday all had open slots before 10am.

Step 2: get through the booking site

Using Playwright, the agent opened the barbershop's booking page and dealt with:

  • Cookie consent banners (dismissed automatically)
  • The login flow (using credentials from environment variables)
  • Service selection ("Men's Haircut")
  • Stylist selection (my preferred person, or next available)

The agent reads the page and works out what the UI elements are, so it adapts instead of following a fixed script. When stylist selection showed up as a dropdown in one place and clickable cards in another, it figured that out on its own.

Step 3: match availability

The agent cross-referenced my calendar availability from Step 1, the barbershop's open slots from the booking page, and my stated preferences (mornings, no Mondays).

It found three matching options: Tuesday 9am, Wednesday 8:30am, Thursday 9:30am.

Step 4: book and confirm

The agent picked Tuesday 9am and went through the booking flow. Before finalizing, it showed me:

"Ready to book: Haircut with [stylist] on Tuesday, January 14th at 9:00am. Total: $32. Confirm?"

I typed "yes" and it completed the booking. The confirmation email showed up 30 seconds later.

Step 5: update the calendar

Last, the agent added the appointment to my Google Calendar with the shop address and a 15-minute travel buffer before the slot.

From prompt to confirmed booking took about 3 minutes.

What went wrong on the first runs?

The first run didn't go smoothly, and I learned a few things fixing it.

CAPTCHAs and bot detection

Some booking sites have anti-automation measures. My barber's site didn't, but I've hit CAPTCHAs on other services.

I handle those with a human in the loop. When the agent hits a CAPTCHA, it pauses, asks me to solve it, and then carries on. Pausing for me keeps the agent away from the site's security and still gets the booking done.

Session timeouts

The first time I ran this, the booking page timed out while the agent was checking my calendar. Playwright can retry, but you have to build that into the workflow. Now the agent saves its state after each step and can pick up where it left off.

Ambiguous availability

In early runs the agent asked clarifying questions, like "Your calendar shows 'tentative' for Tuesday 9am, should I treat that as available or blocked?" Those were good questions, so I added the answer to my constraints: tentative counts as available unless it's a client-facing meeting.

Why are booking flows so hard for AI agents?

I get asked a lot why booking a haircut is a hard problem for AI. It looks simple from the outside: pick a time, fill out a form, click confirm. In practice these flows are full of landmines.

Most booking sites build the form as you go. The available times depend on what you picked before (service type, stylist, date), so the DOM changes after every step. An agent can't fill out a static form. It has to interact with the page, wait for it to re-render, and read the new state before moving on.

The flows are also stateful. Booking sites keep session state across steps, and if the agent is too slow between steps the session can expire. If it goes back to change a selection, everything downstream often resets. Handling that well takes retry logic and checkpointing.

Bot detection goes beyond CAPTCHAs. Many booking platforms fingerprint behavior (mouse movements, timing patterns, headers), and headless browsers get flagged more often than you'd expect. Running Playwright in headed mode with realistic viewport sizes and user-agent strings helps.

Sessions expire fast, sometimes in as little as 5 minutes. If your agent stops to check a calendar or deal with an error, it can lose the session entirely, so you need logic that resumes from a checkpoint.

Payment adds another layer. If the site charges at booking time, you often end up in a third-party processor (Stripe, Square) embedded as an iframe. Playwright needs special handling for cross-origin iframes, and some payment forms actively resist automation.

General-purpose agents still fail often on mainstream booking sites like Booking.com and Google Flights. Getting reliable results on one specific site takes targeted engineering on top of a general-purpose agent.

Which browser automation tools are worth using in 2026?

When I first built this, Playwright was the obvious pick for browser automation. There are more options now, and I'd count five as production-grade:

  1. Playwright + Claude Code (DOM-driven). This is what I used. You write Playwright scripts, or have Claude Code write them, and they work with the DOM through CSS selectors and accessibility labels. It's reliable, but it breaks when the UI changes.
  2. Stagehand by Browserbase (DOM-driven). This is the new option I find most interesting. Stagehand wraps Playwright with AI-friendly methods, so you describe what you want in natural language instead of writing CSS selectors. It cuts a lot of boilerplate, and scripts tend to survive page redesigns because they point at elements by intent instead of by selector.
  3. Browserbase (cloud-hosted). Cloud infrastructure for running headless browsers at scale. It handles anti-bot fingerprinting, session management and captcha services, which makes it a good fit for production workloads.
  4. Anthropic Computer Use (vision-driven). It takes screenshots and works the screen the way a person would. It's slower and less reliable than the DOM-driven tools, but it can handle canvas-only apps and complex UIs that resist DOM inspection.
  5. OpenAI CUA (vision-driven). Similar to Anthropic Computer Use, but it runs through OpenAI's API, with the same trade-off of more flexibility and less reliability.

The split that matters is DOM-driven versus vision-driven. DOM-driven tools (Playwright, Stagehand) work directly with page elements and are more reliable. Vision-driven tools (Computer Use, CUA) "see" the screen like a person and do better on apps that don't expose a clean DOM. For most booking flows I'd go DOM-driven.

If I started this project today, I'd use Stagehand instead of raw Playwright. Natural-language selectors would have saved me the headache when my barber's site changed its UI.

One more option: Claude Code's desktop app (launched March 2026) can now work with native desktop applications directly. If a booking flow has a desktop app, you could skip the browser entirely.

What surprised me

The clicking turned out to be easy. Writing down my preferences clearly was the hard part.

Once the agent has access to my calendar, my constraints in writing, and a browser it can operate, it can handle a lot of tasks we usually file under "too annoying to automate."

The booking site could have been anything: a restaurant reservation, a doctor's appointment, a DMV slot. The pattern is the same every time. Check my availability, go through a website, find a match, book it.

An assistant that tells me "here are the available slots" is helpful. An agent that books the slot saves me the task, which is a much bigger deal. It's the difference between a calculator and an employee.

The AI agent pattern I reuse

I don't think of this as a one-off script. I reuse the same four parts:

  1. Intent capture: preferences and constraints, written down once
  2. Context access: my calendar, plus email, contacts and so on when a task needs them
  3. Tool execution: web navigation, form filling, confirmations
  4. A feedback loop: "Here's what I'm about to do, approve?" or "I hit a blocker, what now?"

Once you've built it, extending it is straightforward. You keep the structure and change the target.

What guardrails keep it safe?

I set up a few things to prevent chaos.

The agent gets the minimum permissions it needs. Calendar access is read-only by default, and I grant write access explicitly for adding events.

Secrets live in environment variables and never in prompts. The agent references them without ever seeing the actual values.

Anything that creates a commitment (a booking, a payment, a cancellation) needs my explicit "yes."

Playwright captures a screenshot at every step, so if something goes wrong I can see exactly what the agent saw.

Websites are flaky, so the agent expects timeouts and knows how to retry.

Where this goes next

If an agent can book a haircut today, it can also coordinate things like:

  • Recurring appointments: "Keep my dental cleanings on a 6-month cycle"
  • Travel logistics: "Book a hotel for my SF trip, close to the conference venue, under $250/night"
  • Expense workflows: "Submit my receipts and match them to the right expense categories"
  • Client scheduling: "Find a 30-minute slot that works for me and this client, then send the invite"

At this point the limit is mostly workflow design and imagination. The models can already do the work.

In August 2025, Gartner predicted that 40% of enterprise applications would include task-specific AI agents by the end of 2026, up from less than 5% in 2025. We're halfway through 2026 now, and that prediction looks about right, since every major productivity suite has shipped agent features. The open question has moved from "can agents do this?" to "can we trust them to do it reliably?", and booking flows are a good test of exactly that.

What didn't work perfectly

To be honest about the rough edges:

My barber's site updated its UI two weeks after I built this. A button moved and the automation broke. Updating the selector took 10 minutes, and that kind of upkeep is the ongoing maintenance cost.

Some flows require human verification by design: 2FA, CAPTCHAs, identity checks. The agent handles them by pausing for my input, but they add time.

Getting my preferences right took a few rounds. My first run booked a 7:30am slot because I said "morning" without giving an earliest time. I learned that one the hard way.

FAQ

Q: Isn't this overkill for booking a haircut?

For one haircut, maybe. But now that the pattern exists, I use it for everything. Adding a new booking workflow costs me almost nothing.

Q: What if the website changes?

It will, and you update the selectors. That's why I recommend Playwright over clicking screen coordinates, since it holds up better when the layout changes. If you use Stagehand (which wraps Playwright with natural-language selectors), scripts survive redesigns more often because they point at elements by intent instead of by CSS selector. Most fixes take 5 to 10 minutes either way.

Q: Does this work for sites that require login?

Yes, the agent handles login flows. Credentials are stored securely and pulled in at runtime.

Q: What about sites with dynamic content or JavaScript-heavy UIs?

Playwright handles modern SPAs well. It waits for elements to load and can work with content that renders dynamically. Some very complex UIs might need extra handling.

Q: Can I run this on a schedule?

Yes. You could have it check every Monday morning for haircut availability and book when you're due. A cron job plus Claude Code plus Playwright gets you automated life admin.

Q: How much does this cost to run?

Claude Code is $20/month for Pro ($100 to $200/month for Max if you need heavier usage). Playwright is free. The API usage per booking costs pennies, which is way less than my time is worth.

Want help automating your own life admin?

Once you've built one AI agent, you start seeing places for the pattern everywhere.

Start with something small and annoying: a booking you keep putting off, a form you fill out over and over, a check you run by hand every week. Build the agent, watch it work, and then ask what else it could do.

If you want help building custom AI agents for your business workflows (scheduling, coordination, data entry, whatever keeps falling through the cracks), that's what we do.

Check out our automation services or read about how we built a data pipeline with AI agents for another example of what's possible.

That's all I got for now. Until next time.

JM

Jason Macht

Founder & CEO, White Space Solutions

Jason builds AI automation systems for real estate investors and business owners. With experience spanning data analytics, direct mail automation, AI voice agents, and revenue intelligence, he helps companies replace manual workflows with intelligent systems that drive measurable results.

Want to get more out of your business with automation and AI?

Let's talk about how we can streamline your operations and save you time.