@startujn render { direction: down; arrow_spacing: 24 } journey AGENT_CHANGE "An AI agent acts, the user confirms" description: "The assistant plans a change to a trip; nothing is booked until the user confirms the plan" unique_id_friendly: agent_change start from_trip { description: "Assistant button on a trip" } view chat { title: "Trip assistant"; description: "Ask for a change in your own words"; route: /trips/:id/assistant } action plan { title: "Work out a plan" } system agent { type: external; title: "AI agent"; host: agent.ai.example; description: "Reads trips and fares, books nothing" } view question { type: modal; title: "The assistant asks"; description: "A question with quick replies" } view confirm { type: modal; title: "Confirm the change"; description: "What changes and the price difference" } view cant_do { type: modal; title: "The assistant can't do this"; description: "Says why and offers the change form" } ref change_form { journey: CHANGE_TRIP; title: "Change a trip"; description: "The form, by hand" } action apply { title: "Change the booking"; description: "Charges the card on file" } system booking { title: "Booking service"; host: booking.travel.example } action notify { type: message; title: "Send the new itinerary"; channel: email } view changed { title: "Trip changed"; description: "New times and receipt"; route: /trips/:id } end done { type: success; description: "Trip moved, itinerary emailed" } from_trip --> chat chat --> plan : [Send] plan -right-> agent { payload: [request, trip] } agent ..> plan { payload: [reply] } plan --> confirm : plan ready { payload: [flight, hotel_nights, price_difference] } plan -left-> question : asks back { payload: [question] } question ..> plan : [Answer] { payload: [answer] } plan -x-> cant_do : cannot do it cant_do --> change_form : [Use the change form] confirm ..> chat : [Edit] { payload: [flight, hotel_nights, price_difference] } confirm ..> chat : [Cancel] confirm --> apply : [Confirm] { payload: [flight, hotel_nights, price_difference] } apply -right-> booking { payload: [flight, hotel_nights, price_difference] } booking ..> apply { payload: [booking_ref] } apply --> notify : changed apply .x.> confirm : fare changed { payload: [price_difference] } notify --> changed changed --> done : [Done] @endujn