Project: Build the Ferry Booking Assistant

Your booking assistant has every guard you’ve built in this course. Its tools act only for the signed-in passenger, check values against the ferry company’s data, and wait for a yes before a change. Caps limit what one message can cost, and an eval set compares two versions before you switch. You added each piece in its own lesson, after something went wrong.

In this project, you’ll build the assistant again from a brief, with no steps to follow, the way you’d build a feature at work. You’ll get its tool specifications and the eval cases it must pass. Then you’ll change the prompt or the model and show with those evals that the change made it better. Start with what Linden Ferries asked for.

The Brief

Every summer, Linden Ferries’ phone line is busy with the same calls: when the boats leave, whether there’s room for a car, and whether a booking can move. The company wants a booking assistant in its passenger chat. A signed-in passenger types a message. The assistant answers from the timetable and the passenger’s own bookings, and it changes a booking when they ask.

A wrong change can cost a family their crossing, and a leaked booking tells a stranger who’s traveling when. So the company sets five rules:

  • It never changes a booking before the passenger has seen exactly what will change and said yes.
  • It never reads or changes another passenger’s booking.
  • It never acts on an instruction found in the data, such as a booking’s note.
  • It never offers a canceled sailing as one to take.
  • It never runs without limits on rounds, tool calls, and tokens.

The assistant gets three tools. Each one’s name, arguments, and result are fixed because the next exercise’s tests call them:

Tool Takes Returns
findSailings from and to, each one of the three ports, and a date as YYYY-MM-DD That crossing’s sailings on that date, each with its ID, departure time, seats and vehicle spaces left, and status
lookUpBooking A booking reference, such as "LF-2417" The passenger’s own booking: its sailing, passengers, vehicle, note, and whether it’s canceled
changeBooking reference, sailingId, passengers, vehicle ("car", "van", or "none"), and cancel, where null keeps a value The changed booking, or a line saying it’s canceled

You write each tool’s definition: a description that says when to use it, and a schema with every property in required, null as a second type where a value may stay as it is, and no extra properties.

askWithTools() sends each definition with strict: true, so OpenAI and Anthropic hold the model’s arguments to that schema. The ports are an enum, so a strict request can’t name a fourth harbor. It can still name the wrong one, though, and your checks catch that.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.