At a glance
- What it does: your agent searches and books flights for a customer through the Duffel API; it only ever sees offers and a booking reference.
- What it adds to your Get Started setup: calls to an outside API, an API key sealed in the enclave, a grant that allows exactly one host, and
{{profile.*}}placeholders. Same key, same organisation agent, a new contractz:<tid>:flightnext to yourvault. - What you need: your Get Started
.env(T3N_API_KEY,AGENT_DID,AGENT_API_KEY), a free Duffel test token, and test credits: registering it costs about as much as registering yourvaultdid, and your agent needs at least 300 credits: the walkthrough uses up the 5 from Get Started, one search costs more than 5, and 100 covered exactly one search and one booking. The passenger’s passport comes from the Private Doc Scanner or a JSON file the customer fills in. - Build ideas: hotels, rail or car hire through another API; the customer approves before the agent pays; per-agent spend limits.
- Sample repo: Terminal-3/z-tenant-flight
z-tenant-flight is a contract that books flights through the Duffel API in test mode. Your agent searches and picks an offer. The customer’s name, contact details and passport go from inside the enclave to Duffel, and the agent only gets back a booking reference.
It’s the natural next step after the walkthrough vault, because it adds everything the vault deliberately leaves out: calls to an outside API.
How it builds on your setup
Same key, same tenant, same organisation agent: the contract registers asz:<tid>:flight next to your vault, and you grant your agent search-offers and book-offer on it.
Where the passenger’s details come from
The T3N profile holds only name and email, so the customer supplies the rest. The contract refuses an expired passport, and a scanned one whose details failed the scanner’s checks or were edited by hand.
Recommended: scan the passport
Scan it with the Private Doc Scanner, signed in with the same Terminal 3 account, so its vault is in your tenant. Run the setup below asnpm run flight -- setup --with-scanner (npm needs the -- to pass the flag through), save a traveller record with just title and phone, and pass the scanner’s reference as scanner_request_id when booking. Nobody types the passport number, and only fields the scanner verified are accepted. If setup says no vault was found but you already have one, it was set up before the scanner recorded contract ids: run npx tsx scripts/setup-vault.ts --reregister in the scanner’s starter/ folder, then run setup again.
Or enter it yourself
The customer types their details into a JSON file and seals it to the contract. A traveller record with a passport (fictional values; field formats are in the README):starter/my-traveller.json (git-ignored), edit it yourself in your editor rather than through an AI assistant, seal it with npm run flight save-traveller my-traveller.json, then delete the file. The sealed copy is the one the contract uses, and a file left on disk is one an assistant working in the folder could read.
Run it
You need your Get Started setup (T3N_API_KEY, plus AGENT_DID and AGENT_API_KEY from Create Your Organisation) and a Duffel test token (duffel_test_…). The repository’s starter/ script does each step:
{ offer_id, passenger_id, total_amount, total_currency }. It gets back { id, pnr, status }.
Ideas to build on it
- Hotels, rail or car hire: the same shape with a different API and
allowed_hosts. - Approval before paying: have the agent search, and the customer confirm, before
book-offerruns. - Spend limits: check a per-agent budget in your own map before booking.