type string. Ignore types you do not use. They reach you as the data: payload of an SSE frame from the event stream, and the final event is also what result on the run returns.
A run that gets to write its own ending emits four events in this order: final, cost, usage, done. A run whose process went away can emit none of them, so do not make done the only thing that ends your loop.
final
The table to store. It is sent once, just before cost, usage and done.
done
{ "type": "done", "stopped": true }. It is the last event of a run that got to write one. An interrupted run can end without it, so treat a terminal status as the end of the run and done as a convenience.
error
cost, usage and done after it, and the run lands as error. A search that was never started does not produce this event at all: a refused POST /v1/searches answers an HTTP status instead, and Errors lists them.
cost
usd is the running dollar total to show a user. Replace the displayed number with the latest usd. It is not a delta. The last value before done is the final cost. On a run that ended early the last stage is Stopped rather than Finished. See Cost.
usage
Provider call and token counts: gemini, jev and parallel, plus page_fetch when pages were fetched outside the search provider. Sent once, between cost and done. It is diagnostic. Do not show it as a cost, and do not add anything in it to the figure from cost.
plan
How the query was split. Safe to ignore if you only render final.
Each filter:
progress
round is 0-based. leads uses the same row shape as final.table, for rows finished so far. have is leads.length.
Live table events
These drive a results grid while the run is in progress.round is 0-based. Filter index is 1-based. Discovery is index 0.
Other events
You can ignore these. They are the background trail.round_start—{round, needed, message}stage_start—{round, index, mode, title, detail}.modeisdiscoveryorfilter.stage_done—{round, index, table, note}.tableis the survivors of that stage.search_done—{round, index, result_count, queries}source_screen—{round, index, kept, dropped, message}. Sent only when pages were dropped before extraction.candidates—{round, index, leads}names extracted for the universe.pre_discovery— remembered sources before web search:filters,fan_out_queries,source_types,sources,rows.discovery_brief—source_types,company_types,people_types,roles,companies,people,counterparties,search_queries,broaden_queries,pivot_queries,angles,why.discovery_policy— later-round source choice:where_to_start,why,queries,exploit,types,avoid,bottleneck.entity_checks,entity_search,verification,verify_searches— per-entity progress.

