Booking Agent
The Booking Agent books a time slot in conversation: a service visit, an appointment, a consultation. It offers only the times your own calendar has free, in your business's time zone. It confirms the booking with the visitor, checks the slot is still free at the moment they say yes, books it exactly as your booking form would, once, and hands back your reference.
Your form stays the fallback. While the agent is available, every road to the booking form leads to it: a typed request ("can someone come tomorrow morning?"), a results card's "Book an appointment", a NxisAI app link to the form. When it's away, the form works exactly as before.
It follows the same pattern as the Quote Agent, with one difference that matters: a slot can be taken by someone else between the visitor's choice and the booking. So it checks, then commits. That's the BOOKING interaction policy.
Requirements: @nxisai/agent-harness 0.12.0 or later on the page (takes doesn't exist before it), the handoff relay, a host that runs server code, a booking form that the site tag registers as a tool (its JSON-LD action is a ScheduleAction or ReserveAction), and an availability source your server can read.
When to use it
| Use the Booking Agent when | Use something else when |
|---|---|
| Your site has a booking, appointment or scheduling form, and somewhere its bookings already go | An agent outside your site (Claude, ChatGPT through the NxisAI app) books against your ReserveAction: that's the lead-funnel-reservation skill. Its link for an on-page action opens your page, and this agent takes it from there |
| You can answer "what's free?" from your own calendar, booking system or table, server-side | The request has no slot, and your business calls back to arrange it: use the Quote Agent |
| One business takes the bookings | A directory with a calendar per business: run one Booking Agent per business, or leave it to lead-funnel-reservation |
Out of scope: payments (a paid booking or ticket belongs to checkout, not this agent; it never asks for card details, passwords or account logins), accounts (it creates none), and rescheduling or canceling an existing booking (it makes new bookings only, and hands those requests back to the assistant or to a person on your team).
The flow
-
Handoff. The visitor asks to book. The on-page agent proposes the handoff, naming the agent, and the visitor presses Send.
-
One question a turn. The agent reads what the handoff already says and asks only for what's missing, in order: the service, the location (only when you have more than one), and the day. Dates are read off a calendar in your time zone, never worked out by the model. A day in the past or beyond your horizon is asked for again.
-
Free times, from your calendar. It asks your availability source for free slots on that day (and the visitor's part of the day, if they said one), filters them by your rules, and offers a few, numbered, with the zone:
Here's what's free:
1. Tue, Nov 10, 8:00 – 10:00 AM CST
2. Tue, Nov 10, 10:00 AM – 12:00 PM CST
3. Tue, Nov 10, 1:00 – 3:00 PM CST
Times are Chicago time. Which would you like? Reply with its number.If nothing is free then, it offers the nearest free times after, starting "Nothing's free then. The nearest times I can see:". If nothing is free within your horizon, it hands back
unresolvedwith your booking form and phone number. A pick by number ("2", "the second one") is read by rule, without a model call. -
Contact details. Then the fields your form asks for, one at a time, each checked on the server (required fields, the shape of an email, 10 to 11 phone digits, your patterns such as a five-digit ZIP, choices from your form's options). A value that fails is asked for again. A gap is never filled in by the model.
-
A summary, and an explicit yes. A summary written by code from the checked values, not by the model:
Here's the booking with Northside Plumbing:
• Service: Drain cleaning
• When: Tue, Nov 10, 10:00 AM – 12:00 PM CST (Chicago time)
• Name: Pat Doe
• Phone: (773) 555-0100
Shall I book it? Say yes to book, or tell me what to change.It books only if the visitor's next message is a plain yes. "Yes, but make it 10" is a change, and the summary is shown again.
-
Re-check, then book once. At the yes, it checks the slot again at your source and against your rules, then books it. See No holds and Booking once.
-
Reference back. It hands back
resolvedwith the reference your sink returned: "You're booked: Drain cleaning, Tue, Nov 10, 10:00 AM – 12:00 PM CST (Chicago time). Your reference is NB-4KQ7M2XH. Northside Plumbing will confirm at pat@example.com." With no reference from your sink, it still books and says so, without one. It never makes a reference up.
Emergencies are phone calls. Words you choose (active flooding, a burst pipe, a gas smell) are checked by rule before any model sees the message. The agent hands back unresolved with your phone number and your safety line, and nothing is booked.
When booking fails. A failed booking isn't retried: the agent hands back unresolved, says your booking form still works, and gives your phone number.
Untrusted text stays data. The visitor's message is screened for instructions aimed at the agent before any model sees it, and reaches the model only as a delimited block of data. A screened message gets "I can only help book a visit with your business" and the next question.
A resolved hand-back counts as your form sent in your analytics, exactly as the form going through would.
Availability
The agent keeps no calendar of its own. It reads free slots from your calendar, booking system or table, through one interface:
interface Availability {
slots(q: { service: string; location?: string; from: string; to: string; limit: number }): Promise<Slot[]>;
}
interface Slot {
id: string; // your source's own id for the slot; your sink is sent it back
start: string; // ISO 8601 instant with an offset or Z: "2026-11-10T08:00:00-06:00"
end: string;
location?: string; // the location's id, when you have more than one
}
-
Free slots only, earliest first, starting in
[from, to)(ISO instants). At mostlimit. -
Your source is the truth. The agent never offers a time your source didn't return. It checks each one against your rules too, and a slot that breaks them (a UTC hour that lands before opening once daylight saving ends) is filtered out, not offered.
-
Read it server-side, at a URL fixed in configuration. The ready-made HTTP source calls your endpoint, set in
BOOKING_AVAILABILITY_URL(withBOOKING_AVAILABILITY_TOKENsent as a bearer token, if it wants one):GET <BOOKING_AVAILABILITY_URL>?service=drain-cleaning&from=2026-11-10T14:00:00.000Z&to=2026-11-11T06:00:00.000Z&limit=24{ "slots": [
{ "id": "2026-11-10T08:00", "start": "2026-11-10T14:00:00.000Z", "end": "2026-11-10T16:00:00.000Z" }
] }locationis sent only when the visitor chose one. An error status offers nothing, and a malformed slot is dropped, rather than guessed at. If you have no such endpoint, write a small one beside your booking code, or implementAvailabilitydirectly against your database. -
Give your endpoint the same rules your own form uses. The agent checks them again; two filters that agree are cheap, and one that drifts books a closed day.
-
No calendar, no agent. Without
BOOKING_AVAILABILITY_URL, the relay lists the agent as unavailable (container hosts refuse to start), and your booking form takes bookings.BOOKING_EXAMPLE_CALENDAR=trueswaps in an in-memory example calendar for local development only. It logs a warning, and must never be set on a live site.
Site rules
Every slot offered obeys your rules, whatever your source returns:
| Rule | Example | Meaning |
|---|---|---|
timeZone | 'America/Chicago' | Your business's IANA time zone. Every time is shown in it, with its abbreviation ("CST", "CDT"), and the offer and summary name the zone |
zoneName | 'Chicago time' | Optional. How the zone is named to the visitor. Defaults to the zone's city |
hours | { mon: [['08:00', '17:00']], sat: [['09:00', '13:00']] } | Opening hours per weekday, in your zone. A day not listed is closed. A slot must start and end inside one range on the same local day |
closed | ['2026-11-26', '2026-12-25'] | Optional. Dates you're closed (YYYY-MM-DD, your zone) |
leadMinutes | 120 | No slot may start sooner than this from now |
horizonDays | 30 | How far ahead a booking may be, in days from today |
offer | 3 | Optional. How many slots to offer at once. Default 3 |
Times are formatted in your locale (en-US writes "Tue, Nov 10, 8:00 – 10:00 AM CST"). Test across your next daylight-saving change.
No holds: re-checked at the yes
The agent doesn't reserve a slot while the visitor reads the summary. An abandoned chat would otherwise block your calendar. Instead, at the visitor's yes, it checks the slot again: at your source, and against your rules, since time has passed since it was offered.
If the slot has gone, taken on your own form or found taken by your sink, nothing is booked. The visitor reads "Sorry — that time was just taken. Here's what's free now:" with fresh slots near the same preference (or the alternatives your sink suggested), picks again, reads a new summary, and says yes again. If nothing else is free, the agent hands back unresolved with your booking form and phone number.
If your booking system supports holds, you can still use them inside your sink (hold and confirm in one call). The agent's contract stays check, then commit.
Booking once
Each booking attempt has an idempotency key, <task id>.<attempt>. Before your sink is called, the agent claims that key with a conditional write in its store. Only the first claim may book, so a retry, a second instance or a repeated yes never books again. A second yes on the same task waits for the first to finish and repeats its result, with the same reference. If it can't learn how the first one ended, it tells the visitor to call you to check, and never books on a guess.
The key goes to your sink with the booking, so your sink can dedupe as well. When a slot turns out to be taken, the attempt number goes up, and the next slot books under a new key. If the agent's store is unreachable, it refuses to book rather than risk booking twice.
The booking sink
The agent books into the same place your form does, its sink, with the same keys, in the same order, with an empty optional field sent as "". Your sink can't tell the two apart.
| Your form's bookings go to | The agent |
|---|---|
| A webhook (your own, or your application through an action binding) | POSTs the identical JSON payload to a URL fixed server-side (BOOKING_SINK_URL), with an Idempotency-Key header and, when a signing secret is set, X-Nxis-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<body>")>, signed with your binding's signing secret (NXIS_WEBHOOK_SIGNING_SECRET) |
| A server handler that saves to your database | Calls the same function the handler calls, so your office is notified the same way and the reference works wherever you look bookings up |
A server-side action binding (webhook or gateway) | Runs the action with nxis_action on your site's MCP server, with an API key held server-side. This path is a draft. An on-page (selfPage) action can't run this way |
| A third-party scheduler the browser posts to | Posts the same payload server-side, if the service accepts a server's post and has a server-side availability API. A service that needs a browser token or a CAPTCHA can't take the agent's |
The sink URL always comes from server-side configuration, never from a request, the handoff or the model.
Your sink has three duties beyond what your form needs (your page's form can ignore all three):
-
Return a reference. Answer success with one:
{ "status": "confirmed", "reference": "NB-7K2M9QXA" }A short prefix and eight characters from an alphabet without look-alikes (
ABCDEFGHJKLMNPQRSTUVWXYZ23456789), from a cryptographic random source. -
Refuse a slot that's no longer free. Answer
409(or"status": "conflict"), optionally with alternatives in theSlotshape:{ "status": "conflict", "alternatives": [ { "id": "…", "start": "…", "end": "…" } ] } -
Dedupe on the
Idempotency-Key. Answer a repeated key with the same booking, not a second one.
Any other answer counts as a failed booking.
Configuration
The agent's skill writes three things for your site, beside the agent itself, which it copies into your project unchanged.
The field spec. One JSON file that both your booking form and the agent read, so they can't drift. posted names the keys your form posts the service, location, slot and time zone under. fields are the contact fields, in order, each with name, label, kind (text, email, phone, choice, longtext), required, and optionally options for a choice, a pattern, and ask, the question to ask when the pattern fails:
{
"posted": { "service": "service", "location": "location", "slot": "slot_id", "start": "start", "end": "end", "timeZone": "time_zone" },
"fields": [
{ "name": "full_name", "label": "Name", "kind": "text", "required": true },
{ "name": "phone", "label": "Phone", "kind": "phone", "required": true },
{ "name": "email", "label": "Email", "kind": "email", "required": false },
{ "name": "zip", "label": "ZIP code", "kind": "text", "required": true, "pattern": "^\\d{5}$", "ask": "And the five-digit ZIP code?" },
{ "name": "notes", "label": "What's happening", "kind": "longtext", "required": false }
]
}
Render your form's inputs from it where you can, or add a test that compares the two. Ask only for what the booking needs.
The site adapter (a BookingSite), one business per agent:
| Member | What it says |
|---|---|
agentName, role | "Northside Booking", "books service visits for Northside Plumbing". The same name as the card, the relay label and the page label |
business | { name, phone }: who is booked, and the number given for emergencies and failures |
services | { id, name, description? }[]: what can be booked, with id as your form posts it |
locations | { id, name, services? }[]: branches, studios or the areas your crews cover, each optionally limited to some services. With none or one, the visitor is never asked |
fields | The contact fields, from the field spec |
rules | Your site rules |
locale | How dates and times are written, such as en-US |
facts, guidance | Two or three sentences about your business for the model, and prompt lines about your form ("offer an email once — 'no' is an answer") |
emergency | pattern (tested on the lower-cased message), examples for the model, and a safety advice line |
fallback | Where the visitor can still book themselves: "the booking form at /book" |
availability | Your availability source |
submit(booking, idempotencyKey) | Books it into your sink, once, and returns { ok: true, reference? }, { ok: false, conflict: true, alternatives? } for a slot that was taken, or { ok: false, error } |
Consent. Before installing, the skill puts this to you and waits for an explicit yes:
The Booking Agent sends each booking conversation — what the visitor types, including their name, phone, address and email — to Anthropic's API to decide the next question. It runs on your API key, billed per turn. It reads free times from your calendar and books only where your booking form books today. While a conversation is open, what the visitor gave is kept in your host's store for its expiry; once it ends, only whether it booked and the reference stay. OK?
Consent to the on-page agent, or to the handoff relay, is not consent to this.
On the page, add the target with takes, naming your booking form's tool. The tool name is your ScheduleAction's (or ReserveAction's) name, lower-cased with spaces and dashes as _: "Book a Visit" becomes book_a_visit. A multi-step booking form is usually one tool, for its first step; takes that one.
agent.handoff = {
relay: '/api/handoff',
targets: {
booking: { kind: 'agent', label: 'Northside Booking',
description: 'books a visit in conversation, from the free times on the calendar',
takes: ['book_a_visit'] },
},
};
In your system prompt, two lines, and no form tool's name:
If they want to book or schedule a visit or an appointment, or ask when someone can come, call transfer_to_agent with target booking.
Never say a time is free yourself. Only if transfer_to_agent does not offer booking, use the booking form tool instead.
A tool the prompt names gets called, even on a turn it wasn't offered, so the fallback says "the booking form tool". If you route between specialist agents with agent.agents, transfer_to_agent must be in the booking specialist's slice. See Targets that take a form for how takes works.
The relay target lists the agent as available only when both a model key and a calendar are configured, which is what makes your form the fallback:
{ name: 'booking', kind: 'agent', label: 'Northside Booking',
description: 'an agent that books a visit in conversation from the free times on the calendar, confirms it with the visitor, and returns a booking reference',
endpoint: '/a2a/booking',
credential: () => ({ Authorization: `Bearer ${process.env.A2A_RELAY_TOKEN}` }),
transcript: false, push: false,
availability: async () => ({ available: Boolean(process.env.ANTHROPIC_API_KEY && process.env.BOOKING_AVAILABILITY_URL) }) }
Endpoint and hosts
The agent mounts two routes on your origin, as an A2A 1.0 endpoint behind your relay:
| Route | What it is |
|---|---|
POST /a2a/booking | The A2A endpoint. Relay only: 403 without the relay's bearer token, 413 over 64 KB |
GET /a2a/booking/agent-card.json | Its Agent Card, pointing at your public origin. The card has one skill, "Book an appointment", with the words you choose: what it collects and two example requests |
GET /.well-known/agent-card.json | The same card, only if no other agent on your site claims that path. Set BOOKING_CARD_WELL_KNOWN=false where another one does |
Profiles exist for Vite (Node), Netlify, Docker, Google Cloud Run, Cloudflare Workers and AWS Lambda. All of them are drafts: the Docker, Cloud Run, Cloudflare and Lambda profiles have been verified locally, the Vite profile in process, and the Netlify profile not yet run. The skill tells you which profile it's using and its status. On any host with more than one instance, the agent's tasks, progress and the booking claim live in a store every instance sees, so the visitor's yes never lands on an instance that didn't show the summary.
| Host | Tasks, progress and the claim | How long an abandoned conversation stays | Secrets | Notes |
|---|---|---|---|---|
| Vite (Node, for development) | Memory | Until the process restarts | .env, git-ignored | |
| Netlify | Netlify Blobs, strong consistency. The claim is a key created only if new | Forever. Netlify Blobs keys never expire: an abandoned conversation stays until someone clears the store. Add a scheduled function that deletes old entries if that matters to you | Netlify environment variables | About ten seconds per response, enough for one turn |
| Docker | Memory on one replica; Redis for more, with the claim as SET NX | Memory: until restart. Redis: a day | .env.local, git-ignored, or Docker secrets as <NAME>_FILE | Its own container behind your reverse proxy. With Redis down it refuses to book, and the relay lists it unavailable |
| Cloud Run | Firestore, with the claim as a conditional create (or Memorystore Redis) | A day, by Firestore TTL | Secret Manager | Scales to zero, so the first visitor after a quiet spell may get the form while the agent starts |
| Cloudflare Workers | A Durable Object per task, holding the task, progress and claim | 30 days after it was last touched | wrangler secret put, never vars | Needs nodejs_compat. Route /a2a/booking* on your zone so the card points at your origin |
| AWS Lambda | DynamoDB, with the claim as a conditional put | 7 days | SSM Parameter Store, SecureString | A Function URL routed through your CloudFront. The card's origin is PUBLIC_ORIGIN, never the request's host |
When a task completes, what the visitor gave is replaced by whether it booked and the reference (or deleted, if nothing was booked). The booking itself goes only to your sink. Your relay keeps its own record of each handoff for 30 days, and the handoff transcript stays off (transcript: false). Logs carry the method, path, status and time, never a body, a header or a visitor's details.
Settings
| Setting | What it is |
|---|---|
ANTHROPIC_API_KEY | Your model key, server-side only. Unset: the agent is listed as unavailable, and your form takes bookings |
A2A_RELAY_TOKEN | The bearer token the relay sends and the agent checks. 32 characters or more, no default |
BOOKING_AVAILABILITY_URL | Your free-slot endpoint, fixed server-side, reachable from the host and fast enough to read twice a turn. Required |
BOOKING_AVAILABILITY_TOKEN | Optional. Sent to it as Authorization: Bearer … |
BOOKING_SINK_URL | Where your booking form posts, fixed server-side, when the sink is a webhook |
NXIS_WEBHOOK_SIGNING_SECRET | Signs each post to the sink (X-Nxis-Signature), as your sink verifies them |
PUBLIC_ORIGIN | Docker, Cloud Run and Lambda: your site's public origin, which the card points at |
BOOKING_CARD_WELL_KNOWN | false when another agent on your site serves /.well-known/agent-card.json |
REDIS_URL | Docker with more than one replica. Unset: memory, one replica only |
BOOKING_EXAMPLE_CALENDAR | Local development only. true, with no availability URL, uses the in-memory example calendar. Never on a live site |
On Docker and Cloud Run, the container's health check (/healthz) says what the agent is configured to do. Keep it off the public internet; the relay's availability can read it directly.
How the skill checks it
| Check | Expect |
|---|---|
GET /api/handoff | booking with available: true. With no model key or no calendar, available: false |
POST /a2a/booking without, or with a wrong, relay token | 403 |
GET /a2a/booking/agent-card.json | The card, pointing at your origin |
| "Can someone look at my water heater tomorrow?" | A handoff proposal with Send, then your calendar's free times, numbered, each with the zone, one question a turn, a summary, "yes", and the hand-back with your reference. One booking at your sink, identical to the form's |
| The same, but book the offered slot on your own form before saying yes | "Sorry — that time was just taken. Here's what's free now:" and nothing booked |
| A results card's "Book an appointment", or a NxisAI app link to the form | The same handoff, not the form |
| "Water is pouring through the ceiling" | A hand-back with your phone number; nothing booked |
| No model key, or no calendar | The same typed request opens your booking form |
Related
- A2A setup: the relay, targets, secrets and hosts
- Quote Agent: the same confirm-and-submit-once pattern, for requests with no slot
- Agents overview: when to use which agent
- Actions & Bindings: routing a form's submissions to your own webhook, and availability checks for agents outside your site
- Agent Skills Library:
lead-funnel-reservation, for bookings made by agents outside your site