Chapter 0213 min read
Core agentic architecture
A supervisor and ten specialist agents work over one shared, event-sourced Trip State. Agents reason and propose; deterministic services verify and commit. Nothing that moves money is ever decided by a model alone.
Key decisions in this chapter
One voice: only the Orchestrator talks to the traveler. Specialists return typed proposals, never chat.
Agents propose, services commit: bookings and payments go through a deterministic Transaction Service behind a commit boundary.
State lives outside agents: an event-sourced Trip State is the single source of truth, so agents are stateless and replayable.
Thin runtime, durable backbone: a small in-house agent runtime on provider SDKs, with Temporal for anything long-running or money-related.
Memory is a product surface: travelers can see, edit and delete everything Zilia remembers.
2.1
Design principles
Eight rules every agent, tool and service follows. When a design debate stalls, these decide it.
- 1
One voice
Only the Orchestrator talks to the traveler. Specialists return typed proposals, never chat, so tone, memory and accountability live in one place.
- 2
Propose, then commit
Agents can only produce a BookingIntent. A deterministic Transaction Service validates and executes it behind the commit boundary.
- 3
State lives outside agents
An event-sourced Trip State is the single source of truth. Agents are stateless, replayable and safe to retry.
- 4
Typed contracts everywhere
Every handoff is a versioned JSON schema in and out. Free text is reserved for the traveler.
- 5
Grounded or silent
Any price, time, policy or availability must come from a tool result with a source id and a timestamp, or it is not shown.
- 6
Cheapest capable model
Each step runs on the smallest model that passes its evals. Frontier models handle planning, trade-offs and recovery.
- 7
Durable by default
Every multi-step job runs as a Temporal workflow that survives crashes, deploys and long waits for a traveler's reply.
- 8
Budgeted autonomy
Every task carries budgets for tokens, time, tool calls and supplier searches. Overruns stop and escalate instead of spiraling.
2.2
System topology
The founding sketch had the right shape. We add three things: a Verifier, a deterministic commit path between agents and suppliers, and a split between detecting problems and resolving them.
Inputs
Traveler messages and live events
Supervisor
Orchestrator: Trip Planner and Router
The only agent that talks to the traveler
Supply agents
- Flight
- Hotel
- Experience and Ground
Planning agents
- Itinerary
- Pricing and Optimization
Lifecycle agents
- Guardian (monitoring)
- Recovery
Cross-cutting
Verifier
Checks sources, hard constraints, policy and Mandates. Can veto anything.
Booking Agent and Transaction Service
Deterministic code: approval tokens, sagas, idempotency, payments. No model moves money.
Single source of truth
Shared Trip State
An event-sourced log of briefs, options, choices, bookings and incidents.
Memory Agent
Long-term memory
Working memory, episodes, Travel DNA, Mandates and a sealed vault.
Tool layer
Supply Gateway and external tools
- Orchestration
- Supply agents
- Planning agents
- Lifecycle agents
- Cross-cutting
- Deterministic code
Added
A Verifier with veto power
Nothing reaches the traveler or the Booking Agent without passing source, freshness, constraint and policy checks.
Changed
Booking is day-one infrastructure
The sketch made booking optional and later. It is the core promise, so it ships first, as deterministic code.
Split
Guardian detects, Recovery decides
Detection is cheap, constant and rule-based. Resolution is rare, expensive reasoning. Different agents, different budgets.
2.3
Agent roster
Eleven agents ship in the MVP, and two more arrive in phases 2 and 3. Model tiers and autonomy are set per agent, not globally.
| Agent | Mission | Key tools | Model tier | Autonomy and phase |
|---|---|---|---|---|
| OrchestratorSupervisor | Understands intent, builds the TripBrief, plans the task graph, routes work, synthesizes options and owns the conversation. | memory.read · state.read · task.dispatch · ui.render · ask_traveler | Frontier reasoning | High for planning. None for spending: it can only request approvals.MVP |
| Flight AgentSupply | Searches, filters and compares flights, holds fares where airlines allow it, and proposes rebooking options. | flights.search · flights.price · flights.hold · fares.calendar · seatmap.get | Small and fast, plus deterministic filters | Medium: searches and holds, never tickets.MVP |
| Hotel AgentSupply | Searches and de-duplicates stays across suppliers, matches room types and cancellation terms, proposes alternatives. | hotels.search · hotels.rates · hotels.rooms · hotels.policy · reviews.aspects | Small and fast; frontier for hard trade-offs | Medium: searches and holds, never books.MVP |
| Experience and Ground AgentSupply | Tours, attractions, restaurants, transfers and rail that fit each day's timing and energy. | experiences.search · transfers.quote · restaurants.availability | Small and fast | Medium: affiliate booking at MVP, native booking in Phase 2.MVP, light |
| Itinerary AgentPlanning | Turns choices into a feasible day-by-day plan that respects opening hours, travel times, pace and naps. | places.details · routes.matrix · solver.schedule · weather.forecast | Frontier proposes, an OR-Tools solver validates | High: no money moves.MVP |
| Pricing and Optimization AgentPlanning | Normalizes all-in prices, assembles bundles, flags real deals and schedules re-shops. | pricing.normalize · bundle.optimize · price_history.query · fx.rates | Mostly deterministic; a small model writes the explanation | Medium.MVP |
| Booking AgentLifecycle | Turns an approved BookingIntent into confirmed bookings through a saga, and handles price changes, sell-outs and partial failures. | txn.validate · txn.saga · payments.authorize · supplier.book · supplier.cancel | Deterministic service; a small model only words exceptions | Low: acts only on a signed approval or Mandate token.MVP |
| GuardianLifecycle | Watches every active trip for delays, schedule changes, weather, advisories and price drops. | events.subscribe · flight_status.track · reprice.schedule · advisories.feed | Rules and small models; no frontier calls on the hot path | High: observes and raises incidents.MVP |
| Recovery AgentLifecycle | Turns an incident into ranked options, checks Mandates, then acts or asks with one-tap choices. | flights.search · hotels.search · mandates.evaluate · txn.request · notify.send | Frontier reasoning | Acts inside Mandates, asks outside them.MVP assisted, Phase 2 autonomous |
| Memory and Preference AgentCross-cutting | Maintains Travel DNA, episodes and companion profiles, and decides what to remember and what to forget. | memory.propose · profile.update · episodes.search · vault.reference | Small and fast, mostly batch | Always on. Every write is visible to the traveler.MVP |
| VerifierCross-cutting | Checks every plan and booking intent against sources, constraints, policy and Mandates before it reaches the traveler or the Booking Agent. | quotes.verify · constraints.check · policy.check · entry_rules.check | Deterministic checks, plus a second model for high-stakes cross-checks | Blocking: can veto anything.MVP |
| Group CoordinatorLater | Runs shared plans, votes, holds, split payments and nudges for group trips. | group.vote · holds.create · payments.split · notify.group | Small and fast; frontier for consensus summaries | Medium.Phase 2 |
| NegotiatorLater | Contacts properties by email and WhatsApp for upgrades, late checkout and group rates. | outreach.email · outreach.whatsapp · offers.record | Frontier, with templates and strict policies | Low: the traveler accepts every offer.Phase 3 |
2.4
How agents collaborate
Agents never call each other directly. They hand off through typed envelopes and react to events on a shared blackboard, the Trip State.
- 01
Understand
The brief builder turns the message and the context pack into a versioned TripBrief and marks every assumption. - 02
Plan
The Orchestrator writes a task graph into Trip State, with dependencies, budgets and deadlines. - 03
Fan out
Independent tasks run in parallel. Partial results stream to the traveler's screen as they land. - 04
Converge
Pricing assembles bundles and the Orchestrator ranks them into three trip candidates. - 05
Verify
The Verifier checks sources, freshness, constraints and policy. Anything that fails is fixed or dropped. - 06
Present
Three candidates, the trade-off of each, and at most one question. - 07
Commit
On approval, the Booking Agent runs the saga behind the commit boundary. - 08
Guard
The Guardian registers monitors. Recovery takes over the moment something breaks.
// Orchestrator → Hotel AgentTaskEnvelope@3 { task_id: "tsk_7Hq2" trip_id: "trp_91x" agent: "hotel" goal: "Shortlist 3 family stays in Kyoto, 4 nights from 14 Apr" inputs: { brief: "brief@v3", arrival: "2027-04-14T16:40+09:00" } hard: ["2 adults + 1 child (3)", "family room or crib", "≤ 15 min walk to a station"] soft: ["quiet street", "breakfast included", "near Nishiki Market"] budgets: { tokens: 12000, seconds: 20, supplier_searches: 4 } returns: "HotelProposal@2"}// Hotel Agent → OrchestratorHotelProposal@2 { options: [3 × { hotel_id, room_id, quote_id, all_in_price, policy, why[] }] assumptions: ["check-in after 15:00 is fine"] constraint_report: { hard: { family_room: "pass", walk_to_station: "pass" } soft: { quiet_street: 0.82, breakfast: 1.0, near_market: 0.64 } } confidence: 0.86 sources: ["q_9F2 @ 12:01:48", "q_9F7 @ 12:01:49", "q_A03 @ 12:01:49"] spent: { tokens: 7840, supplier_searches: 3 }}Every envelope carries a goal, references into Trip State instead of copied data, hard and soft constraints, budgets and the schema the result must match. Every proposal reports what it assumed, how each constraint fared, how confident it is, which quotes it relied on and what it spent. That makes every handoff testable in isolation and every decision auditable later.
The blackboard: events agents subscribe to
FlightSelected
The Hotel Agent re-checks check-in timing; the Itinerary Agent re-plans day one.
HotelChanged
The Itinerary Agent recomputes walking times; Pricing rebuilds the bundle.
BriefUpdated
Pricing re-ranks; the Orchestrator decides whether a new search is worth its budget.
IncidentRaised
Recovery starts a workflow; the Itinerary Agent adapts the affected days.
2.5
Resolving conflicts
Agents disagree all the time: the cheapest flight lands after the best hotel's reception closes. A fixed precedence order and one utility function settle it, and the traveler is asked only when it matters.
- 1
Safety, law and supplier rules
Entry requirements, fare rules, sanctions screening
- 2
Traveler hard constraints
No red-eyes, step-free access, a child's age
- 3
Active Mandates
Rebook a same-day nonstop for up to €150 more
- 4
Budget ceiling
$9,000 all-in, never exceeded silently
- 5
Soft preferences, weighted by Travel DNA
Quiet street 0.82, boutique style 0.72
- 6
Agent heuristics
Fewer hotel changes, earlier first day
// One score per trip candidate. Weights come from Travel DNA.U = w_price × price_score + w_time × time_score // value of time: €38 per hour + w_comfort × comfort_score // cabin, layovers, room size + w_fit × preference_fit // neighborhood, style, pace − w_risk × risk_penalty // tight connections, non-refundable- Hard constraints are never traded off. A violation is shown to the traveler, never buried in a score.
- Ask one crisp question when it matters. If the top two candidates are within 5% utility but trade different things, ask instead of guessing.
- Two rounds, then escalate. Agents get at most two re-planning rounds with each other before the Orchestrator brings it to the traveler.
- No silent overwrites. Every write to Trip State carries the version it read. Stale writes are rejected and re-planned.
- Deterministic tie-breaks. Refundability first, then fewer segments, then supplier reliability, and margin last.
2.6
Memory architecture
Six layers, from minutes to years. The deeper the layer, the more sensitive the data and the less of it a model ever sees.
Layer 1
Working memory
Model-visibleThe live conversation, the scratchpad and partial results for the current task.
- Store
- Redis and the context window
- Lifetime
- Hours
- Written by
- Orchestrator
Layer 2
Trip State
Model-visibleEvery brief version, option shown, choice, booking and incident, as an append-only event log.
- Store
- Postgres event store
- Lifetime
- The trip, plus legal retention for bookings
- Written by
- Every agent, as events
Layer 3
Episodic memory
Summarized for modelsPast trips and moments worth remembering: a noisy room in Rome, a missed connection in Frankfurt.
- Store
- Postgres with pgvector
- Lifetime
- Years, with decay
- Written by
- Memory Agent
Layer 4
Travel DNA
Summarized for modelsConstraints and preferences with confidence and source, companions, budgets and loyalty programs.
- Store
- Postgres, typed columns
- Lifetime
- Until changed or deleted
- Written by
- Memory Agent and the traveler
Layer 5
Mandates
Model-visibleThe rules Zilia may act on, with spend caps, constraints, undo windows and expiry.
- Store
- Postgres, signed records
- Lifetime
- Until revoked or expired
- Written by
- Only the traveler
Layer 6
Vault
Never model-visiblePassports, dates of birth, payment tokens and loyalty numbers.
- Store
- Tokenization vault such as Basis Theory or VGS
- Lifetime
- Until deleted
- Written by
- The traveler; read only by the Transaction Service
- Write policy: stated facts are written at once with high confidence. Inferred preferences start low and decay unless choices reinforce them.
- Scoping: preferences belong to a trip type, so a business-trip habit never leaks into a family holiday.
- Context pack: every turn starts with under 2,000 tokens: a profile summary, the three most relevant episodes, the active trip and the active Mandates.
- Sensitive data: models never see raw passports or cards. The Transaction Service swaps vault tokens for real values only at the moment of booking.
- Control: travelers can see every memory and where it came from, and edit or delete it. Deletion is real and reaches backups within 30 days.
2.7
Tools and integrations
Agents never touch a supplier API. They call a small set of typed tools on the Supply Gateway, which normalizes, caches, meters and logs every call.
- Coarse and idempotent: one hotels.search, not forty endpoints. Retrying a call never double-books.
- Read and write are separate. Write tools need a signed approval token that no text, including a prompt injection, can produce.
- Every result is grounded: source ids, timestamps and expiry travel with the data.
- Small toolsets: no agent sees more than about twelve tools, and schemas are versioned so agents pin what they were tested on.
- Compacted results: only the top normalized options reach a model. Raw supplier data never enters a prompt.
- Search budgets: every turn has a supplier search budget, which protects look-to-book ratios with suppliers.
- One protocol: the gateway is exposed internally as MCP servers, so the same tools can later be offered to partner assistants as a distribution channel.
| Tool | Type | Backed by | Needs approval |
|---|---|---|---|
| flights.search · flights.price | Read | Duffel; a GDS joins in Phase 2 | No |
| flights.hold | Hold | Duffel hold orders, where airlines allow | No, free holds only |
| hotels.search · hotels.rates | Read | getmyhotels supply, Expedia Rapid, Hotelbeds | No |
| experiences.search | Read | Viator, GetYourGuide | No |
| routes.matrix · places.details | Read | Google Routes and Places | No |
| entry_rules.check | Read | Sherpa | No |
| flight_status.track | Subscribe | FlightAware AeroAPI or Cirium | No |
| weather.forecast | Read | Tomorrow.io | No |
| txn.request | Write | Transaction Service | Yes: a traveler tap or a Mandate token |
| supplier.book · supplier.cancel | Write | Transaction Service only | Yes, and never callable by a model |
| notify.send | Write | Notification Service | Policy-checked: quiet hours and channel rules |
2.8
Walkthrough: one request, end to end
One real request, twelve steps, from a voice note to a booked trip and a price drop captured three weeks later. Step through it to see which components act and what they write.
The request · WhatsApp voice note
“Plan 9 days in Japan for the three of us in April. Our daughter is 3. No red-eyes, under $9,000 all in, and we love food markets.”
Step 1 of 12 · 12:00:02
Conversation ServiceA voice note arrives
The WhatsApp voice note is transcribed and normalized into a canonical message, then handed to the Orchestrator with the traveler's verified identity.
Active components
- Channels: WhatsApp and web (active)
- Orchestrator (active)
- Memory
- Flight
- Hotel
- Itinerary
- Pricing
- Verifier
- Booking (commit)
- Guardian
- Trip State
- Supply Gateway
event: message.receivedchannel: whatsapp · voice note, 14 straveler: trv_3f9 (verified phone)text: "Plan 9 days in Japan for the three of us in April. Our daughter is 3. No red-eyes, under $9,000 all in, and we love food markets."Illustrative scenario. Prices, times and quote ids are examples, not live data.