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 complex for AI agents. Multi-step navigation, calendar checks, and real-world scheduling with Claude Code and Playwright.

JM

Jason Macht

Founder @ White Space

January 12, 2026 Β· Updated May 27, 2026
13 min read

I was three weeks overdue for a haircut. It's a 15-minute task, pull up my calendar, check the barber's website, find an open slot, book it. But it kept getting deprioritized. There's always something more urgent.

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

The AI agent checks my Google Calendar, navigates my barber's booking website with Playwright, and schedules the appointment end-to-end. One command.

It sounds like overkill for a haircut. But here's the thing, life admin is the perfect proving ground for AI agents. It's repetitive, rules-based, and way too annoying relative to its actual importance. And once you've built the pattern for one task, you can apply it everywhere.

Let's go ahead and jump into it.

The Setup: What I Gave the AI Agent

Before the agent could do anything, I needed to give it context and constraints. I put together a short brief:

Where I go: The specific barbershop and their booking portal URL

Stylist preference: Who I normally see (or "anyone available" as a fallback)

Time constraints:

  • Prefer weekday mornings before 10am
  • Avoid Mondays entirely
  • At least 2 days' notice required

Access I provided:

  • Google Calendar read access (to check my availability)
  • Booking site credentials (stored in environment variables, not pasted in prompts)
  • My payment card was already saved on the site, so no new payment details needed

Approval boundary: The agent could complete the booking, but for anything that created a commitment or cost, I wanted final confirmation before it proceeded.

This took maybe 5 minutes to set up. The constraints are the key, the clearer you are about preferences, the less back-and-forth with the agent later.

The Tools

Three things made this work:

Claude Code as the orchestrator. It plans the approach, writes code, handles errors, and iterates. This is the "brain" that coordinates everything.

Google Calendar integration so the agent knows when I'm actually free. No point booking an 8am haircut when I have a client call.

Playwright for browser automation. The agent navigates the booking website like a real user, clicks, fills forms, selects options. Most booking systems don't have APIs, so this is how you get things done.

The key insight: this isn't a chatbot answering questions. It's an agent executing a workflow across multiple systems. That's a fundamentally different capability.

How It Worked: Step by Step

Step 1: Calendar Check

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. It identified several open morning slots. Tuesday, Wednesday, and Thursday all had availability before 10am.

Step 2: Handle the Booking Site

Using Playwright, the agent opened the barbershop's booking page. It handled:

  • Cookie consent banners (auto-dismiss)
  • Login flow (using credentials from environment variables)
  • Service selection ("Men's Haircut")
  • Stylist selection (my preferred person, or next available)

This is where things get interesting. The agent doesn't just follow a script, it reads the page, understands the UI elements, and adapts. When the stylist selection was a dropdown versus clickable cards, it figured it out.

Step 3: Match Availability

The agent cross-referenced:

  • My calendar availability (from Step 1)
  • The barbershop's open slots (from the booking page)
  • 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 selected Tuesday 9am and proceeded 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 arrived 30 seconds later.

Step 5: Calendar Update

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

Total time from prompt to confirmed booking: about 3 minutes.

Handling the Tricky Parts

Not everything went smoothly on the first run. Here's what I learned:

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.

The right approach here is human-in-the-loop: when the agent hits a CAPTCHA, it pauses and asks me to solve it, then continues. It's not about bypassing security, it's about handling the exception gracefully.

Session Timeouts

The first time I ran this, the booking page timed out while the agent was checking my calendar. Playwright can handle retries, but you need to build that into the workflow. Now the agent saves state after each step and can resume from where it left off.

Ambiguous Availability

Early runs had the agent asking clarifying questions: "Your calendar shows 'tentative' for Tuesday 9am, should I treat that as available or blocked?" These are good questions. I updated my constraints to handle them: tentative = available unless it's a client-facing meeting.

Why Booking Flows Are Deceptively Hard for AI Agents

I've gotten a lot of questions about why booking a haircut is actually a hard problem for AI. On the surface it looks simple: pick a time, fill a form, click confirm. In practice, these flows are full of landmines.

Dynamic form elements. Most booking sites render available times based on prior selections (service type, stylist, date). The DOM changes after each step. An agent can't just fill out a static form - it has to interact with the page, wait for re-renders, and read the new state before proceeding.

Stateful multi-step flows. Booking sites maintain session state across steps. If the agent is too slow between steps, the session can expire. If it goes back to change a selection, the downstream state often resets. Managing this state gracefully requires retry logic and checkpointing.

Anti-bot detection. Even for sites without explicit CAPTCHAs, many booking platforms use behavioral fingerprinting (mouse movements, timing patterns, header analysis). Headless browsers get flagged more often than you'd expect. Running Playwright in headed mode with realistic viewport sizes and user-agent strings helps.

Session timeouts. Booking sites aggressively expire sessions, sometimes in as little as 5 minutes. If your agent pauses to check a calendar or handle an error, it can lose the session entirely. Building resume-from-checkpoint logic is essential.

Payment flow complexity. If payment is required at booking time, you often hit a third-party payment processor (Stripe, Square) embedded as an iframe. Interacting with cross-origin iframes in Playwright requires special handling, and some payment forms actively resist automation.

The success rates reflect this difficulty. Open-source agent benchmarks show only 27.3% task completion on Booking.com and 35.7% on Google Flights. These aren't obscure corner cases - they're mainstream booking sites. Getting to reliable performance on a specific site takes targeted engineering, not just a general-purpose agent.

The Browser Automation Landscape (2026)

When I first built this, Playwright was the clear choice for browser automation. The landscape has expanded since then. There are now five production-grade approaches:

1. Playwright + Claude Code (DOM-driven) - What I used. You write Playwright scripts (or have Claude Code write them), interacting with the DOM via CSS selectors and accessibility labels. Reliable but brittle to UI changes.

2. Stagehand by Browserbase (DOM-driven) - The most interesting new option. Stagehand wraps Playwright with AI-friendly methods, so instead of writing CSS selectors, you describe what you want in natural language. It reduces boilerplate by 60-70% and scripts tend to survive page redesigns because they reference elements by intent rather than selector.

3. Browserbase (cloud-hosted) - Cloud infrastructure for running headless browsers at scale. Handles anti-bot fingerprinting, session management, and captcha services. Good for production workloads.

4. Anthropic Computer Use (vision-driven) - Takes screenshots and interacts with the screen like a human. Slower and less reliable than DOM-driven approaches (12-17 percentage points lower success rate) but handles canvas-only apps and complex UIs that resist DOM inspection.

5. OpenAI CUA (vision-driven) - Similar to Anthropic Computer Use but runs through OpenAI's API. Same trade-offs: more flexible, less reliable.

The key distinction is DOM-driven vs. vision-driven. DOM-driven tools (Playwright, Stagehand) interact directly with page elements and are 12-17 percentage points more reliable. Vision-driven tools (Computer Use, CUA) "see" the screen like a human and are better for apps that don't expose clean DOM structure. For most booking flows, DOM-driven is the right choice.

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

Also worth noting: Claude Code's desktop app (launched March 2026) can now interact with native desktop applications directly. If a booking flow has a desktop app, you could skip the browser entirely.

What Surprised Me

The hard part isn't the clicking, it's encoding preferences clearly.

Once the agent has:

  • Access to my calendar
  • My constraints documented
  • The ability to operate a browser

...it can do a lot of tasks we treat as "too annoying to automate."

The booking site could have been anything. A restaurant reservation. A doctor's appointment. A DMV slot. The pattern is identical: check my availability, navigate a website, find a match, book it.

The AI Agent Pattern

This isn't a one-off script. It's a reusable archetype:

1. Intent capture: Preferences and constraints, documented once 2. Context access: Calendar (and optionally email, contacts, etc.) 3. Tool execution: Web navigation, form filling, confirmations 4. Feedback loop: "Here's what I'm about to do, approve?" or "I hit a blocker, what now?"

Once you've built this pattern, extending it is straightforward. Same structure, different target.

Guardrails: Making This Safe

A few things I set up to prevent chaos:

Minimum permissions. The agent has read-only calendar access by default. Write access is granted explicitly for adding events.

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

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

Logging and screenshots. Playwright captures a screenshot at each step. If something goes wrong, I can see exactly what the agent saw.

Retry strategy. Websites are flaky. The agent expects timeouts and knows how to retry gracefully.

Where This Goes Next

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

  • 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"

The limiting factor is increasingly workflow design and imagination, not raw capability.

Gartner predicted that by 2026, 40% of enterprise applications would include task-specific AI agents. We're halfway through 2026 now, and that prediction looks about right. Every major productivity suite has shipped agent capabilities. The bottleneck has shifted from "can agents do this?" to "can we trust them to do this reliably?" - which is exactly the kind of problem that booking flows expose.

What Didn't Work Perfectly

Being honest:

Websites change. My barber's site updated their UI two weeks after I built this. A button moved, and the automation broke. I spent 10 minutes updating the selector. This is the ongoing maintenance cost.

Some flows require human verification. 2FA, CAPTCHA, identity verification, these are friction points by design. The agent handles them by pausing for my input, but they add time.

Preference encoding takes iteration. My first run booked a 7:30am slot because I said "morning" without specifying a floor. Learned that one the hard way.

The Real Takeaway

Tools and models are now good enough to act, not just advise.

An AI assistant that tells me "here are available slots" is helpful. An AI agent that actually books the slot is transformational. That's the difference between a calculator and an employee.

The average professional spends 4.8 hours per week just scheduling meetings, over six full work weeks per year. Businesses using AI scheduling see 30-40% reductions in administrative overhead. These numbers compound.

If you're not experimenting with agents in your personal and professional workflows, you're leaving time on the table. Start small. Automate one annoying task. Then apply the pattern everywhere else.

FAQ

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

For one haircut? Maybe. But once the pattern exists, I use it for everything. The marginal cost of adding a new booking workflow is near zero.

Q: What if the website changes?

It will. You update the selectors. This is why I recommend Playwright over screen-coordinate clicking, it's more resilient to layout changes. If you use Stagehand (which wraps Playwright with natural-language selectors), scripts survive redesigns more often because they reference elements by intent rather than CSS selector. Most updates take 5-10 minutes either way.

Q: Does this work for sites that require login?

Yes. The agent handles login flows. Credentials are stored securely and referenced 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 interact with dynamically rendered content. Some very complex UIs might need more specific handling.

Q: Can I run this on a schedule?

Absolutely. You could have it check every Monday morning for haircut availability and book when you're due. Cron job + Claude Code + Playwright = automated life admin.

Q: How much does this cost to run?

Claude Code is $20/month for Pro ($100-$200/month for Max if you need heavier usage). Playwright is free. The actual API usage per booking is pennies. Way less than the value of my time.

Ready to Automate Your Life Admin?

The best part about building an AI agent: once you've done it once, you see the pattern everywhere.

Start with something small and annoying. A booking you keep putting off. A form you fill out repeatedly. A check you run manually every week.

Build the AI agent. Watch it work. Then ask yourself: what else could this 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 exactly 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.