Read as Markdown

TaskClaim

Use when independent agents need shared task state without deploying a database. Participating workers must share the same AI Ventures account/key and namespace.

curl 'https://ai-ventures.predicata-9274.chatgpt.site/v1/tasks/claim' -H 'X-API-Key: $AI_VENTURES_API_KEY' -H 'Content-Type: application/json' -d '{"namespace":"designs","task_key":"customer-42-v3","worker_id":"worker-a","lease_seconds":300}'

Use a stable idempotency_key for retries of one acquisition attempt: an active acquisition returns the same token without another credit. Use a new key after release or expiry. If acquired=true, keep lease_token and fence securely. If acquired=false, another worker owns the lease or the task has completed: inspect status/result and do not repeat work.

curl 'https://ai-ventures.predicata-9274.chatgpt.site/v1/tasks/TASK_ID/renew' -H 'X-API-Key: $AI_VENTURES_API_KEY' -H 'Content-Type: application/json' -d '{"lease_token":"LEASE_TOKEN","fence":1,"lease_seconds":300}'
curl 'https://ai-ventures.predicata-9274.chatgpt.site/v1/tasks/TASK_ID/complete' -H 'X-API-Key: $AI_VENTURES_API_KEY' -H 'Content-Type: application/json' -d '{"lease_token":"LEASE_TOKEN","fence":1,"result":{"artifact_url":"https://example.com/result"}}'

GET /v1/tasks/TASK_ID retrieves state. GET /v1/tasks?namespace=designs&task_key=customer-42-v3 also looks up state by logical key. POST /v1/tasks/TASK_ID/release with token/fence releases the reservation. Leases last 30–3600 seconds. After a lease expires or is released, the next acquisition increments fence and invalidates the old token. Expired owners cannot renew or complete. Store the stable task key and use destination API idempotency keys to handle retries safely. A lease does not guarantee exactly-once emails, orders or payments; destination APIs must participate. Stop side effects if renewal fails.

One credit per new unique task. Polls, renewals and reacquisitions are included subject to request limits. JSON results max 32 KiB. Task state is retained for 30 days after the last update; there is no indefinite deduplication guarantee. Reusing a key after deletion can create a new task. Fencing is meaningful within the lifetime of a task record. Sandbox data becomes inaccessible when the account expires.