Repository navigation
Handles Perplexity's asynchronous cancel and reports why a run stopped early.
BREAKING CHANGE: AgentStatus gains CANCELLING. Code that matches every AgentStatus member with no default needs a branch for it. It is not terminal: wait() keeps polling until CANCELLED.
Fixed
cancel()no longer raises on a successful cancel. Perplexity acknowledges with{response_id, status: "cancelling"}; the client readsresponse_id, and falls back toidonly whenresponse_idis absent.cancel()refuses an acknowledgement whose run ID differs from the ID you asked to cancel, withINVALID_RESPONSEand guidance to useretrieve(). Only the one cancel request is sent.
Added
AgentResponse.incomplete_reason()returns the provider's reason for an incomplete run, such asmax_output_tokens, orNone.