leaseAgentTasks
# leaseAgentTasks
POST
/agent/tasks/lease
const url = 'http://localhost:8080/api/v1/agent/tasks/lease';const options = { method: 'POST', headers: {cookie: 'hs_session=<hs_session>', 'Content-Type': 'application/json'}, body: '{"limit":5,"platforms":["instagram"],"agentVersion":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/agent/tasks/lease \ --header 'Content-Type: application/json' \ --cookie hs_session=<hs_session> \ --data '{ "limit": 5, "platforms": [ "instagram" ], "agentVersion": "example" }'Claims up to limit due tasks for 10 minutes. Respects per-platform hourly caps and the
token’s platform list. Returns an empty list when nothing is due; the response says
when to ask again.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
limit
integer
platforms
Only lease tasks for these platforms (e.g. the ones the agent’s browser is logged into).
Array<string>
agentVersion
string
Responses
Section titled “Responses”Leased tasks.
Media typeapplication/json
object
tasks
required
Array<object>
object
id
required
string
kind
required
string
account
required
object
id
required
string
platform
required
string
handle
required
string
platformUserId
string | null
profileUrl
required
string format: uri
personName
required
string
knownItemIds
Up to 50 most recent platform item IDs already stored; skip these.
Array<string>
wantKinds
Array<string>
maxItems
integer
instructions
required
Short platform playbook key, e.g. “instagram.fetch.v1” (see agents/skills/homestead/references/platforms.md).
string
leaseExpiresAt
required
string format: date-time
attempts
required
integer
retryAfterSeconds
required
When to lease again if tasks is empty or after finishing these.
integer
Examples
Exampleseed
Derived from fixtures/seed.json.
{ "retryAfterSeconds": 300, "tasks": [ { "account": { "handle": "lin.cooks", "id": "acc_01j9te0skfktnnmw6zvew46azb", "personName": "Lin", "platform": "instagram", "platformUserId": "", "profileUrl": "https://www.instagram.com/lin.cooks/" }, "attempts": 0, "id": "tsk_01j9a1b2c3d4e5f6g7h8j9k02t", "instructions": "instagram.fetch.v1", "kind": "fetch", "knownItemIds": [ "C9xYzAbCdEg", "C9xYzAbCdEf" ], "leaseExpiresAt": "2026-10-17T09:10:00.000Z", "maxItems": 20, "since": "2026-10-17T08:00:00.000Z", "wantKinds": [ "story", "post", "video" ] }, { "account": { "handle": "somsak_runs", "id": "acc_01j9dfpvstm7aq628gwwc9xkq3", "personName": "Somsak", "platform": "x", "platformUserId": "", "profileUrl": "https://x.com/somsak_runs" }, "attempts": 1, "id": "tsk_01j9a1b2c3d4e5f6g7h8j9k02v", "instructions": "x.fetch.v1", "kind": "fetch", "knownItemIds": [], "leaseExpiresAt": "2026-10-17T09:10:00.000Z", "maxItems": 20, "since": null, "wantKinds": [ "post", "video", "link" ] } ]}