Available today
Python SDK
The official library for Python 3.10 or newer, standard library only. Create a task, wait for the decision and check the callback's signature before you act, with a synchronous client and one for `asyncio`.
Where it fits
- Python SDK
- TaskToHuman
- The person who decides
- Signed decision back to your code
- Signed decision back to your code
What it does
create_task,get_task,list_tasks(or every page withiter_tasks) andcancel_task;AsyncTaskToHumandoes the same withasyncio.wait_for_decisionchecks the task until a person decides, for scripts, tests and short agent turns; in production, a callback brings the decision.verify_callbackchecks theTTH-Signatureheader against the raw body and returns the task, or raisesSignatureVerificationError.- No dependencies, an
idempotency_keyon every create and safe retries. Open source under the Apache License 2.0.
Set it up
Run
pip install tasktohuman.Create an API key for the workspace, a test key first, and keep it in
TTH_API_KEY. Use it on your server only.Create a task with
create_task, then act on the verified callback, or wait withwait_for_decision.
# pip install tasktohumanimport osfrom tasktohuman import TaskToHumantth = TaskToHuman(os.environ["TTH_API_KEY"])task = tth.create_task( "approve_refund", title="Refund €249 to order #4821?", payload={"order_id": "4821", "amount": 249, "reason": "Arrived damaged"}, callback_url="https://shop.example.com/hooks/tasktohuman", deadline_minutes=120, idempotency_key="refund-4821", # a retry with the same key returns the same task)# task["state"] is "notified"; the decision comes to callback_url, signed.