For the judges
How it works
Many small workshops have no front desk: the phone is answered by a mechanic between jobs, and when a lift breaks someone re-plans the day by hand. Here two AI agents do the front desk's work, and a person confirms every change.
01
Two agents, one for each side of the counter
Both run Claude through CopilotKit's built-in agent. The server builds one per request from the signed session, so the tools are bound to who is asking: staff get the workshop agent, a customer gets the front desk tied to their own customer reference.
Where in the code:src/lib/frontdesk.tssrc/lib/agent.tssrc/app/api/copilotkit/[[...slug]]/route.ts
02
Architecture
A conversation flows from the browser to the agents over AG-UI. Every change, whether an agent's tool call or a person's click, takes the same path through the permission check and the server's own checks.
A conversation
Customer or staff
In the browser, signed in with a session cookie
Website
Next.js pages with CopilotKit's chat and tool cards
Agents on Vercel
CopilotKit runtime at /api/copilotkit: the front desk or the workshop agent, picked from the session
Claude
Anthropic API, through the shared AI module
Every change
An agent's tool call
Propose a re-plan, apply an approved one
A person's click
Approve, Confirm a booking or a new time
Permission check
check() against the one table in capabilities.ts
Server checks
Skills, shifts, lift kinds, outages, double bookings, personal data
Database
Supabase Postgres in the EU (Ireland)
Where in the code:src/app/api/copilotkit/[[...slug]]/route.tssrc/lib/ai.tssrc/lib/capabilities.tssrc/lib/workshop.tssrc/lib/db.ts
03
AG-UI and A2UI, and what each one does here
Why not A2A: our two agents serve different people and never need to talk to each other, so an agent-to-agent protocol would add a network hop without changing anything a user sees.
Where in the code:src/app/api/copilotkit/[[...slug]]/route.tssrc/components/approval-card.tsxsrc/components/frontdesk-tools.tsxsrc/components/a2ui-catalog.tsxsrc/lib/agent.ts
04
The agent proposes, a person decides
No change reaches the board, a booking or a customer without a person's click. Bookings and moves happen only when the customer picks a time on their own card, then clicks Confirm.
- 1Agent
Proposes
Saves a re-plan with propose_replan. Nothing on the board moves.
- 2Server
Validates
Checks skills, shifts, lift kinds, outages and double bookings, and sends any problem back to the agent to fix.
- 3Lead mechanic
Approves
The run pauses on an approval card. The click goes straight to the server, never through the model.
- 4Server
Applies
apply_proposal moves the jobs, records the outage and queues the customer messages. It refuses anything not approved.
- On the board
- A “What changed” strip lists every moved job, old time to new, and any job still on a broken lift is drawn “Needs a new time”.
- In the activity log
- Staff see every proposal, approval and change. The Refused filter lists what the server turned down, with its reason.
The server refuses, whatever the model says:
- Applying a proposal that isn’t approved, or no longer fits the board
- Approval by anyone except the lead mechanic
- Changing an estimate the customer accepted
- Proposal texts with phone numbers, emails or number plates
- Booking a slot that was just taken, or moving someone else’s booking
All of these except the taken slot are written to the activity log, under Refused.
Where in the code:src/lib/workshop.tssrc/app/api/proposals/[id]/decision/route.tssrc/app/api/bookings/route.tssrc/app/api/bookings/[id]/move/route.tssrc/components/approval-card.tsx
05
If the model fails: a scripted fallback
A live demo can't depend on a model API answering. If it's down or misbehaving, the lead mechanic switches the workshop chat to a script with no AI model. It covers the demo's disruption, a broken lift, and nothing else.
How it's switched on: the lead mechanic's AI agent switch in the Workshop header changes their own browser to Scripted fallback on. If the API is down, AGENT_FALLBACK=scripted on the server turns it on for all staff. One click switches the AI agent back on.
For a lift outage it calls, in this order
- plan_around_outage
- propose_replan
- request_approval
- apply_proposal
Then, for jobs that don't fit before the lift is back, one more proposal with their earliest real slots, approved the same way.
What stays the same
- The same server tools, called in a fixed order
- The same approval cards: nothing moves until the lead mechanic approves
- The same permission checks on the server
- The same AG-UI events, so the chat shows the same tool lines and the board moves the same way
What doesn't
- No AI model: a script reads the message and runs the steps
- Lift outages only, such as “Lift 2 is broken until Thursday”, in English or Romanian
- No A2UI options card: jobs that don’t fit get a second approval card proposing their earliest real slots
It never passes as the AI: the header switch reads “Scripted fallback on”, and the chat says “Scripted fallback, no AI model” with every plan it proposes.
Where in the code:src/lib/scripted-agent.tssrc/components/agent-mode-toggle.tsx
06
One permissions table, enforced by the server
Who may do what (customer, mechanic, lead mechanic, agent) lives in a single file. The API routes and the agent's write tools call its check(), and the Capabilities page renders the same file, so what judges read is what runs.
16 capabilities. For the agent:
1 allowed · 6 need a person’s approval · 9 never allowed
Every rule links to the code that enforces it
Under the table, How each rule is enforced says what stops people and what stops the agent for each capability, with links to the functions on GitHub. Its Try it box breaks one rule live: ask the workshop agent to lower an accepted estimate, and the server refuses and logs it under Refused.
What the table states but the code doesn't enforce yet
- Ordering a part, cancelling a booking, editing customer details: Not built yet, for anyone: no screen, route or agent tool does them.
- Changing an accepted estimate, for people: No estimate editor yet. The agent's attempt is refused and logged.
- Never diagnosing: No agent has a diagnosis tool, but what it writes in its own words is held by its instructions. The eval below measures it.
Where in the code:src/lib/capabilities.tssrc/components/capability-table.tsxsrc/app/capabilities/enforcement.ts
07
GDPR: the agents never see customers' personal data
Agent tools return references and the car's make, model and year. No agent tool returns customer data. The server reads a customer's first name only to fill it into a message the lead mechanic approved.
What the agent sees
- C-1042 (a customer reference)
- J-107 (a job reference)
- Ford Focus 2015 (make, model, year)
What never reaches the model
- Customer names
- Phone numbers
- Emails
- Number plates
Proposal texts with phone numbers, emails or plates are refused. The database is in the EU, and all demo data is fictional.
See it live: the Agent's view
- Sign in as Lead mechanic · Ioana M. and open Workshop.
- Click Agent's view in the board's header: customers' names turn into references like
C-1001; the car stays. - Show raw data opens one job exactly as the agent's tools receive it.
The board then reads /api/board/agent-view, which returns agentDayPlan: the same function the agent's get_day_plan and the re-plan planner read. The route asks the permissions table, so a mechanic, who may see only their own jobs, gets a 403.
Known limit: what a customer types into the chat reaches the model as typed. The front desk never asks for personal data.
Where in the code:src/lib/workshop.tssrc/lib/agent.tssrc/lib/frontdesk.tssrc/app/api/board/agent-view/route.ts
08
Tested on the live site
We sent the front desk 30 test messages in Romanian and English and recorded every tool call it made. It ran with Claude Haiku on the deployed prompt (commit af550fa, Dec 5).
- Routed correctly
- 28/30
- Both misses were questions, not wrong routes: the customer named a car that isn't on their account, and the agent asked which car.
- Safety cases redirected
- 4/4
- Brakes, smoke, fuel smell and the like go to a mechanic with fixed advice.
- Diagnoses
- 0
- No diagnosis-like phrases in any reply; 28 of 30 runs went straight to a booking card.
Where in the code:docs/triage-eval.mddocs/triage-examples.jsonscripts/eval-triage.mjs