Chat can propose a booking. Only an authenticated, hash-bound HTTP decision can buy it.
A trip assistant may read a traveller's bookings and prepare a pending action. Authority to approve and pay sits behind an authenticated, hash-bound endpoint the model cannot reach.
The service can report the status of a queued task without claiming that a model performed it. Separate admission, execution and the eventual result to understand what the event stream proves.
A traveller opens an isolated trip and types: "What flights are in my trip?" The server checks the bearer token and the idempotency key, and only then opens an event stream. In the demo lane no model runs. Admission writes turn.started and queues the job; the worker later writes text.delta and turn.completed. On that empty trip the demo lane calls read_trip and answers that it could not find flight bookings, without booking citations.
Now the traveller types "approve and pay" for a pending booking action. The reply is text: chat cannot authorize payments, bookings or cancellation. The action stays pending. No executions-repository rows are stored, including after the job queue drains.
A chat assistant is safe near money only when approval is an authenticated, hash-bound endpoint the model has no tool for. Prompt wording is not the guard. The synthetic trip desk and its five transport tests stay on the demo lane; the provider-backed loop is the live adapter.
The argument
- Admission precedes the stream. Auth, validation and idempotent turn creation finish before any event header leaves the server.
- Demo is a named lane. The scripted path never pretends to be a model. The demo model adapter refuses to emit model output, and an unreachable live model returns an error instead of a demo answer.
- The model gets reads and proposals. A prepared action carries
executionAuthorized: falseand waits for review. - Money moves on a decision route. The decision must present the stored approval hash, and a wrong hash is HTTP 409
APPROVAL_HASH_MISMATCH.
Who is allowed to decide
The tempting design lets the assistant that quotes hotels also confirm them. That blurs persuasion with authority. A model can be talked into anything a message can say. It cannot call an endpoint that is not in its tool list.
Look at the arrows on the left of the figure. The traveller sends POST turns and receives events, and a rejected request comes back as plain JSON with a 4xx status. The model's arrows are on the right: it reads and observes through the registry, and the queue sits beside it. No arrow leads from the model to an approval.
The refusals are ordinary HTTP. Anonymous callers, strangers, malformed bodies, and a replayed clientTurnId with different text all return JSON statuses and never allocate an X-Turn-ID. The refusals test asserts that no extra turn row appears.
Two runtimes sit behind that gate, and only one is an agent.
| Demo lane | Live lane | |
|---|---|---|
| Decides the next step | Keyword rules | One tool call or a structured reply with no call; parallel calls disabled |
| Tools | Scripted read_trip and search calls | Strict schemas, parallel calls disabled at the provider |
| Pay or approve | Returns a fixed refusal | Cannot reach an approval; can only prepare a pending one |
| Bounds | A fixed script | 8 steps, a 90-second timeout, a 100,000-character context cap |
The demo lane is deterministic control flow, so we do not call it an agent. run_agent dispatches the keyword demo in demo mode; the step loop runs only for the live adapter. In that loop the model picks a registry tool, the host validates the arguments, and the loop ends when the model returns a validated reply (via respond or a direct structured reply), or the host aborts it with an error, including the step, context, and timeout limits. On the last step the host removes every tool but respond, so the final generation is an answer, not another probe.
The registry is deny-by-default and has seven tools: read the trip, search options, find places, estimate travel time, prepare an action, suggest a memory, and respond. None approves or pays. Its tool descriptions tell the model that search does not book and that prepare_action never approves or executes. Those strings guide the model; the executor separately denies any tool outside the registry.
Discovery uses a second model loop, built on PydanticAI. Its output validator rejects any destination or peer trip the tools did not return.
What the evidence shows
The strongest claims here are the ones a test refuses to let slide. Others are design, and we mark them so.
Read the four columns left to right. The question triggers read_trip for bookings. The registry keeps what came back as its sources map. In the live lane, the reply schema offers only the entity ids and action ids already in that map. validate_reply then raises UNGROUNDED_REPLY for any id that is not there, and for a stated fact whose value differs from the observed field. The panel shows execAuth: false. The tool result says pending_user_review and executionAuthorized false, and the stored action stays pending.
The demo lane gets grounding for free, because it builds citations from the booking ids it just read. The live lane needs the enum narrowing and the validator, because a model can propose anything.
The README records a scripted run on an isolated synthetic database with zero model calls. Four turns completed with one worker attempt each. Replays produced no duplicate messages. Over a 70-second idle the stream carried four native pings, and the largest gap between frames was 15.001 seconds. That is evidence about transport and durability. It says nothing about how well a live model answers.
The README also fixes the stream's rules. Auth, validation, idempotent admission, ownership and after cursor checks run before the headers, so a malformed resume is an HTTP 422 and never a half-open stream. A subscription lasts 120 seconds or ends on turn.completed or turn.failed. A client disconnect cancels delivery only, never the turn.
Two gaps remain. None of the five native cases tries to enqueue execute-action from chat text, and none renders an answer that cites a booking no tool returned. The approval test comes closest. Those paths are covered by the registry code, and we have not run a live model against them.
The turn we ran
The turn below is the demo lane's happy path, replayable after a dropped connection.
The client posts. FastAPI queues an assistant-turn job. The worker appends events to the journal, and the journal delivers turn.completed back to the client. The footnote in the figure is the point: if the client disconnects, the queued job still completes and a later GET ?after= resumes the frames.
The first test builds a fresh database, creates a trip named "Native SSE isolated trip", and posts the flights question. The response is text/event-stream, exposes X-Turn-ID, and runs from turn.started with id 1 to turn.completed. A second request with the cursor from the second frame returns only later events. Re-posting the same body under the same idempotency key returns the same frame ids and leaves one turn row and one assistant message. The assertion on the reply itself is weak: it checks that a message was stored, not what it says.
In the disconnect case, after the drop the job stays queued; once the worker runs, the turn status is completed and the job status is succeeded. In the heartbeat case, the worker is withheld, the stream shows at least two : ping comments, and the turn still completes once pumping starts. The stream is disposable and the ledger is not.
The one check to copy
Copy the approval boundary, not the travel nouns. The test is test_chat_approve_cannot_execute_and_only_explicit_correct_decision_does.
It prepares a book action and leaves it pending. It then posts a chat turn that asks to approve and pay for that action id. The turn completes. The reply contains "Chat cannot authorize", the action row is unchanged, and the executions repository is empty even after the job queue drains.
Then the decision route. A body with a wrong approvalHash returns HTTP 409 and APPROVAL_HASH_MISMATCH. The decision route marks the action approved and queues one execution; the worker then marks the execution and the action succeeded, and a replay adds no second row. The hash fingerprints schema travel-approval-v1, the stable action fields (id, user, trip, kind, option, target booking, lines, total, terms, trip revision, expiry), and the server quote hash, so a client cannot approve a price it was not shown. Anywhere money or cancellation could be smuggled through natural language, keep authority on a host-owned endpoint and test that chat is text only.
Close
It is tempting to judge a trip assistant by the polish of its prose. The evidence here supports a narrower claim. Admission, replay, grounded citations and hash-bound approval are separate mechanisms, and each refusal is an HTTP fact, not a matter of tone.
To extend the desk, add tools the registry can observe, add screens that post explicit decisions, and add a test showing that chat cannot take the shortcut. Destination discovery follows the same line: "Plan a trip here" creates a trip with linked source evidence, and it makes no reservation or payment. Keep that lane separate in the docs, so nobody mistakes inspiration chat for the approval desk on an active trip.
How is this page?
Last updated on