Skip to main content

Polling with requests

The choice handler above picks the first option. Replace it with your own logic. To stop a task early, POST /v1/agents/abort with {"sessionId": session_id}.

Uploading a file

Streaming with sseclient-py

Use this from a long-lived process where holding a connection for minutes is fine.
Approvals on the streaming path are answered with POST /approve from another thread or process; the stream stays open while it waits.