Skip to content

2.1/Design principles

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

  1. One voice: only the Orchestrator talks to the traveler. Specialists return typed proposals, never chat.

  2. Agents propose, services commit: bookings and payments go through a deterministic Transaction Service behind a commit boundary.

  3. State lives outside agents: an event-sourced Trip State is the single source of truth, so agents are stateless and replayable.

  4. Thin runtime, durable backbone: a small in-house agent runtime on provider SDKs, with Temporal for anything long-running or money-related.

  5. 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. 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. 2

    Propose, then commit

    Agents can only produce a BookingIntent. A deterministic Transaction Service validates and executes it behind the commit boundary.

  3. 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. 4

    Typed contracts everywhere

    Every handoff is a versioned JSON schema in and out. Free text is reserved for the traveler.

  5. 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. 6

    Cheapest capable model

    Each step runs on the smallest model that passes its evals. Frontier models handle planning, trade-offs and recovery.

  7. 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. 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

WebAppWhatsAppiMessageTelegramSupplier webhooksFlight statusPrice re-shops

Supervisor

Orchestrator: Trip Planner and Router

The only agent that talks to the traveler

Brief builderPlannerRouterSynthesizer

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.

Commit boundary

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

Duffel (NDC)GDS (Phase 2)getmyhotels supplyExpedia RapidHotelbedsViatorGetYourGuideMozioFlight statusWeatherMaps and placesEntry rulesStripe
  • Orchestration
  • Supply agents
  • Planning agents
  • Lifecycle agents
  • Cross-cutting
  • Deterministic code
Figure 2.1 · Zilia agent topology. Colors mark agent families; the dashed box is code, not a model.

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.

AgentMissionKey toolsModel tierAutonomy and phase
OrchestratorSupervisorUnderstands 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_travelerFrontier reasoningHigh for planning. None for spending: it can only request approvals.MVP
Flight AgentSupplySearches, filters and compares flights, holds fares where airlines allow it, and proposes rebooking options.flights.search · flights.price · flights.hold · fares.calendar · seatmap.getSmall and fast, plus deterministic filtersMedium: searches and holds, never tickets.MVP
Hotel AgentSupplySearches and de-duplicates stays across suppliers, matches room types and cancellation terms, proposes alternatives.hotels.search · hotels.rates · hotels.rooms · hotels.policy · reviews.aspectsSmall and fast; frontier for hard trade-offsMedium: searches and holds, never books.MVP
Experience and Ground AgentSupplyTours, attractions, restaurants, transfers and rail that fit each day's timing and energy.experiences.search · transfers.quote · restaurants.availabilitySmall and fastMedium: affiliate booking at MVP, native booking in Phase 2.MVP, light
Itinerary AgentPlanningTurns choices into a feasible day-by-day plan that respects opening hours, travel times, pace and naps.places.details · routes.matrix · solver.schedule · weather.forecastFrontier proposes, an OR-Tools solver validatesHigh: no money moves.MVP
Pricing and Optimization AgentPlanningNormalizes all-in prices, assembles bundles, flags real deals and schedules re-shops.pricing.normalize · bundle.optimize · price_history.query · fx.ratesMostly deterministic; a small model writes the explanationMedium.MVP
Booking AgentLifecycleTurns 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.cancelDeterministic service; a small model only words exceptionsLow: acts only on a signed approval or Mandate token.MVP
GuardianLifecycleWatches every active trip for delays, schedule changes, weather, advisories and price drops.events.subscribe · flight_status.track · reprice.schedule · advisories.feedRules and small models; no frontier calls on the hot pathHigh: observes and raises incidents.MVP
Recovery AgentLifecycleTurns an incident into ranked options, checks Mandates, then acts or asks with one-tap choices.flights.search · hotels.search · mandates.evaluate · txn.request · notify.sendFrontier reasoningActs inside Mandates, asks outside them.MVP assisted, Phase 2 autonomous
Memory and Preference AgentCross-cuttingMaintains Travel DNA, episodes and companion profiles, and decides what to remember and what to forget.memory.propose · profile.update · episodes.search · vault.referenceSmall and fast, mostly batchAlways on. Every write is visible to the traveler.MVP
VerifierCross-cuttingChecks 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.checkDeterministic checks, plus a second model for high-stakes cross-checksBlocking: can veto anything.MVP
Group CoordinatorLaterRuns shared plans, votes, holds, split payments and nudges for group trips.group.vote · holds.create · payments.split · notify.groupSmall and fast; frontier for consensus summariesMedium.Phase 2
NegotiatorLaterContacts properties by email and WhatsApp for upgrades, late checkout and group rates.outreach.email · outreach.whatsapp · offers.recordFrontier, with templates and strict policiesLow: the traveler accepts every offer.Phase 3
Table 2.1 · Agent roster. Autonomy describes what an agent may do without a traveler approval or a Mandate token.

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.

  1. 01

    Understand

    The brief builder turns the message and the context pack into a versioned TripBrief and marks every assumption.
  2. 02

    Plan

    The Orchestrator writes a task graph into Trip State, with dependencies, budgets and deadlines.
  3. 03

    Fan out

    Independent tasks run in parallel. Partial results stream to the traveler's screen as they land.
  4. 04

    Converge

    Pricing assembles bundles and the Orchestrator ranks them into three trip candidates.
  5. 05

    Verify

    The Verifier checks sources, freshness, constraints and policy. Anything that fails is fixed or dropped.
  6. 06

    Present

    Three candidates, the trade-off of each, and at most one question.
  7. 07

    Commit

    On approval, the Booking Agent runs the saga behind the commit boundary.
  8. 08

    Guard

    The Guardian registers monitors. Recovery takes over the moment something breaks.
Handoff envelope
// 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"}
Typed proposal
// 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.

Wins every conflictYields
  1. 1

    Safety, law and supplier rules

    Entry requirements, fare rules, sanctions screening

  2. 2

    Traveler hard constraints

    No red-eyes, step-free access, a child's age

  3. 3

    Active Mandates

    Rebook a same-day nonstop for up to €150 more

  4. 4

    Budget ceiling

    $9,000 all-in, never exceeded silently

  5. 5

    Soft preferences, weighted by Travel DNA

    Quiet street 0.82, boutique style 0.72

  6. 6

    Agent heuristics

    Fewer hotel changes, earlier first day

Utility function
// 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
  1. Hard constraints are never traded off. A violation is shown to the traveler, never buried in a score.
  2. Ask one crisp question when it matters. If the top two candidates are within 5% utility but trade different things, ask instead of guessing.
  3. Two rounds, then escalate. Agents get at most two re-planning rounds with each other before the Orchestrator brings it to the traveler.
  4. No silent overwrites. Every write to Trip State carries the version it read. Stale writes are rejected and re-planned.
  5. 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.

  1. Layer 1

    Working memory

    Model-visible

    The live conversation, the scratchpad and partial results for the current task.

    Store
    Redis and the context window
    Lifetime
    Hours
    Written by
    Orchestrator
  2. Layer 2

    Trip State

    Model-visible

    Every 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
  3. Layer 3

    Episodic memory

    Summarized for models

    Past 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
  4. Layer 4

    Travel DNA

    Summarized for models

    Constraints 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
  5. Layer 5

    Mandates

    Model-visible

    The 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
  6. Layer 6

    Vault

    Never model-visible

    Passports, 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.
ToolTypeBacked byNeeds approval
flights.search · flights.priceReadDuffel; a GDS joins in Phase 2No
flights.holdHoldDuffel hold orders, where airlines allowNo, free holds only
hotels.search · hotels.ratesReadgetmyhotels supply, Expedia Rapid, HotelbedsNo
experiences.searchReadViator, GetYourGuideNo
routes.matrix · places.detailsReadGoogle Routes and PlacesNo
entry_rules.checkReadSherpaNo
flight_status.trackSubscribeFlightAware AeroAPI or CiriumNo
weather.forecastReadTomorrow.ioNo
txn.requestWriteTransaction ServiceYes: a traveler tap or a Mandate token
supplier.book · supplier.cancelWriteTransaction Service onlyYes, and never callable by a model
notify.sendWriteNotification ServicePolicy-checked: quiet hours and channel rules
Table 2.2 · Tool catalog for the MVP. Write tools are callable only through the Transaction Service.

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 Service

A 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
Trace
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.