status field says where the search is. Check the HTTP status first, then status.
Task status
Every successful answer (200 or 202) carries status, on POST /v1/flight_ai_search, on the task read and on :cancel.
On
POST /v1/flight_ai_search without streaming, a 200 always carries one of the last four statuses: the turn is over, and nothing more arrives for it. The task read answers 200 with any status, working included, so keep reading it while status is working.
A completed reply can still ask the traveler something, with no question field, for example Changing a date, an airport or a filter may find some. when no fare meets every filter, or Tell me where from, where to and when. for a message that is not a flight request. Always show message. The traveler’s reply goes in the same conversation.
When part of the answer could not be searched, the turn still ends completed, with the options found and a not_searched note for the rest. See When nothing matches.
In the event stream, task.status events also carry submitted, the moment a turn is accepted. A task read shows that moment as working.
Why a search fails
A failed task answers200 with status: "failed" and an error:
message is safe to show to the traveler. Branch on code.
The JSON answer of a failed turn can carry charge, for what the turn used before it stopped.
HTTP statuses
Errors use the Jinko error format:{"error": {"code": "...", "message": "..."}}. See Errors.
All four routes
POST /v1/flight_ai_search
GET /v1/flight_ai_search/tasks/{task_id}
A task stays readable after its conversation expires.
