Agent Assistant
Leading an embeddable AI travel-planning experience: the architecture and contracts that turn a streamed conversation into product actions, grounded recommendations and recoverable failure.
- Responsibility
- Principal ownership — architecture & implementation
- Scope
- FastAPI, Preact, OpenAI, MCP & host bridges
- Foundations
- Typed streaming · semantic discovery · LLM evaluation suite
- Project state
- In progress — live availability rollout across services
Search identifies candidates. A live check confirms the exact stay and party before availability is claimed.
Streamed prose, product cards, dates and next steps have separate typed contracts.
Semantic discovery across Rails APIs, MCP and the assistant has explicit retrieval and product-card boundaries.
Structured-itinerary validation and a help-assistant track extend the LLM evaluation suite, alongside a 70% backend test-coverage gate.
The problem
An assistant can produce a convincing answer without the evidence to act on it. In travel planning, a property that matches a search is not necessarily available for the requested dates and rooms — and a plausible itinerary is not the same as one the host application can accept.
Agent Assistant connects a conversation to real product context, accommodation discovery, itinerary actions and availability tools. The engineering task is to make those connections useful while preserving the distinction between a suggestion, a confirmed fact and a completed product action.
My responsibility
I led architecture and implementation of the embeddable AI travel-planning experience, connecting FastAPI, Preact, OpenAI and existing booking workflows. I worked with UX on the product experience and across product, design and backend boundaries to keep the assistant aligned with the systems it acts on.
My ownership covered structured streaming, semantic accommodation discovery, reusable AI itinerary components, host application bridges, prompt and tool contracts, availability evidence, LLM evaluation and service coverage. The application is built collaboratively; the decisions and implementation work described here are the areas I owned.
The constraints
- The service and interface need to distinguish streamed prose from structured product data: cards, dates and next steps.
- Product search, semantic discovery and live supplier availability provide different kinds of evidence.
- A live check needs exact dates, a resolved property and explicit room occupancy.
- Supplier failures, unsupported connections and timeouts must remain visible as uncertainty.
- Recommendations span multiple stops, room configurations and an itinerary handoff into the host application.
- Contracts cross the assistant, Rails APIs, MCP tools and host application, so changes need coordinated validation.
Key decisions
Make structured events a product contract
I implemented typed server-sent events between FastAPI and Preact/TypeScript, separating streamed prose from product cards, dates and next steps. This replaced brittle client-side parsing with incremental rendering.
Structured itinerary actions give the host application an explicit integration boundary instead of asking it to infer an action from arbitrary text. The trade-off is coordination: event names and payloads need matching producer, consumer and test updates. I accepted that cost because the interface needs to distinguish response content, progress and actionable data reliably.
Own semantic discovery across three systems
I led engineering for semantic accommodation discovery across Rails APIs, MCP and the assistant. That meant aligning retrieval prompts, typed product-card contracts and host actions so a discovered property could become a usable recommendation rather than an ungrounded suggestion.
The boundary is deliberate: retrieval identifies candidates, typed cards define what the assistant can present, and host actions define what the product can do next. Keeping those responsibilities separate makes the discovery path testable and lets the assistant evolve without silently changing the booking workflows underneath it.
Preserve uncertainty instead of flattening outcomes
I changed the assistant’s availability instructions so indexed search supports discovery, while live supplier checks provide confirmation for the exact stay and room party.
Only a live result of available confirms the requested stay and party. not_available supports an unavailable response and an alternatives flow. on_request, unsupported, failed and timed_out leave availability unconfirmed for different reasons. The contract prohibits silently substituting indexed inventory when a live check fails. Successful results from one property can be retained when another check fails. The product can communicate partial progress without turning uncertainty into a false conclusion.
Build reuse into the AI surface
I built reusable, themed AI itinerary components and typed host-application bridges for multi-stop recommendations, room availability and itinerary handoff. The components carry the product’s visual language; the bridges carry the contract between the embeddable assistant and the host.
This is where the work compounds. A new itinerary pattern or host action attaches to a shared boundary rather than being rebuilt inside the conversation, and the same typed contract supports rendering, testing and integration.
Delivery & validation
The architecture connects FastAPI orchestration, OpenAI Responses API streaming, Rails APIs, MCP tools, a Preact widget and host application actions. Stream handling, structured bridges and itinerary components have distinct responsibilities within the chat feature.
I extended an existing LLM evaluation suite with structured-itinerary validation and a help-assistant track. That separates two questions: whether the assistant produced a valid itinerary structure, and whether it behaved correctly as a help assistant. Alongside prompt and instruction tests, this makes the recommendation policy testable independently of the supplier integration.
I refactored streaming services while preserving event contracts and introduced a 70% backend test-coverage gate. The product-side implementation includes separate supplier and tool-contract coverage. Live availability still connects independently deployed services, so release acceptance needs to exercise the complete path from supplier response to recommendation and host interface.
Scope & foundations
The assistant is a platform boundary, not a single chat surface. Typed SSE, product-card contracts and host bridges let the embeddable experience plug into booking workflows without the host parsing prose or the assistant owning host behaviour.
Semantic discovery spans Rails APIs, MCP and the assistant. Retrieval prompts and typed cards are aligned so candidates can become grounded recommendations, and reusable themed components carry multi-stop recommendations, room availability and handoff across surfaces.
The evaluation suite and the 70% backend coverage gate raise the baseline for future AI changes. Structured-itinerary validation and the help-assistant track make behaviour reviewable, while preserved event contracts keep streaming refactors from silently changing the product interface.
What changed
Streaming became a typed product interface. Prose, cards, dates and next steps have separate contracts; incremental rendering replaced brittle client-side parsing.
Discovery became a cross-system capability. Rails APIs, MCP and the assistant share retrieval prompts, typed product-card contracts and host actions for accommodation recommendations.
Availability claims have a defined evidence threshold. Search results identify candidates; an exact live check is required before describing a stay as available, and failure outcomes retain their meaning.
AI quality became measurable. Structured-itinerary validation, a help-assistant evaluation track and a 70% backend test-coverage gate make behaviour and regressions visible.
Reflection
AI product quality depends on the boundaries around the model: the evidence a tool returns, the action the host can perform, and the uncertainty the interface preserves. The principal work is designing those boundaries so product, design and backend teams can change their side without breaking the others.
A confident response needs a clear account of what the system actually knows.