curl --request POST \
--url https://guidinghand.ai/v1/sessions/{session_id}/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Turn on Dark Mode",
"agent_id": "<string>",
"agent_version": 2,
"request_id": "<string>",
"metadata": {
"customer_id": "cus_42"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'Turn on Dark Mode',
agent_id: '<string>',
agent_version: 2,
request_id: '<string>',
metadata: {customer_id: 'cus_42'}
})
};
fetch('https://guidinghand.ai/v1/sessions/{session_id}/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://guidinghand.ai/v1/sessions/{session_id}/tasks"
payload = {
"prompt": "Turn on Dark Mode",
"agent_id": "<string>",
"agent_version": 2,
"request_id": "<string>",
"metadata": { "customer_id": "cus_42" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"object": "task",
"task_id": "<string>",
"kind": "computer",
"procedure": {
"id": "<string>",
"revision": 123,
"ran_on": "steps"
},
"session_id": "<string>",
"agent_id": "<string>",
"status": "queued",
"done": true,
"prompt": "<string>",
"result": "<string>",
"error": "<string>",
"conversation_id": "<string>",
"paused_for": {
"kind": "approval",
"id": "<string>",
"conversation_id": "<string>"
},
"pending": {
"type": "question",
"question_id": "<string>",
"question": "<string>",
"options": [
"<string>"
],
"customer_can_answer": true,
"conversation_id": "<string>"
},
"cursor": 123,
"metadata": {
"customer_id": "cus_42"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"active_seconds": 123,
"model": "gpt-6-astra",
"effort": "low",
"usage": {
"input_tokens": 123,
"cached_tokens": 123,
"cache_write_tokens": 123,
"output_tokens": 123,
"reasoning_tokens": 123
},
"cost_cents": 123,
"agent_version": 3,
"agent_draft": true,
"created_by": {
"type": "user",
"email": "jane@acme.com"
},
"replay_url": "<string>",
"recording": {
"frames": 123
},
"events": [
{
"cursor": 123,
"type": "started",
"message": "<string>",
"ts": "2023-11-07T05:31:56Z",
"data": {}
}
],
"procedures": [
{
"id": "<string>",
"revision": 123,
"title": "<string>",
"confidence": 123
}
]
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}Start a task
Starts a task on the session’s computer, which must be connected (status: connected). One task runs at a time per computer. When the agent has a guardrails.scope, the task is checked against it first, and fails if it is clearly something else.
curl --request POST \
--url https://guidinghand.ai/v1/sessions/{session_id}/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Turn on Dark Mode",
"agent_id": "<string>",
"agent_version": 2,
"request_id": "<string>",
"metadata": {
"customer_id": "cus_42"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'Turn on Dark Mode',
agent_id: '<string>',
agent_version: 2,
request_id: '<string>',
metadata: {customer_id: 'cus_42'}
})
};
fetch('https://guidinghand.ai/v1/sessions/{session_id}/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://guidinghand.ai/v1/sessions/{session_id}/tasks"
payload = {
"prompt": "Turn on Dark Mode",
"agent_id": "<string>",
"agent_version": 2,
"request_id": "<string>",
"metadata": { "customer_id": "cus_42" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"object": "task",
"task_id": "<string>",
"kind": "computer",
"procedure": {
"id": "<string>",
"revision": 123,
"ran_on": "steps"
},
"session_id": "<string>",
"agent_id": "<string>",
"status": "queued",
"done": true,
"prompt": "<string>",
"result": "<string>",
"error": "<string>",
"conversation_id": "<string>",
"paused_for": {
"kind": "approval",
"id": "<string>",
"conversation_id": "<string>"
},
"pending": {
"type": "question",
"question_id": "<string>",
"question": "<string>",
"options": [
"<string>"
],
"customer_can_answer": true,
"conversation_id": "<string>"
},
"cursor": 123,
"metadata": {
"customer_id": "cus_42"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"active_seconds": 123,
"model": "gpt-6-astra",
"effort": "low",
"usage": {
"input_tokens": 123,
"cached_tokens": 123,
"cache_write_tokens": 123,
"output_tokens": 123,
"reasoning_tokens": 123
},
"cost_cents": 123,
"agent_version": 3,
"agent_draft": true,
"created_by": {
"type": "user",
"email": "jane@acme.com"
},
"replay_url": "<string>",
"recording": {
"frames": 123
},
"events": [
{
"cursor": 123,
"type": "started",
"message": "<string>",
"ts": "2023-11-07T05:31:56Z",
"data": {}
}
],
"procedures": [
{
"id": "<string>",
"revision": 123,
"title": "<string>",
"confidence": 123
}
]
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"test_case_ids": [
"<string>"
],
"decided_by": {
"type": "person",
"email": "<string>",
"key_id": "<string>"
},
"conversation_id": "<string>",
"agent_id": "<string>",
"approval_id": "<string>",
"question_id": "<string>"
}
}Authorizations
Body
Which version of the agent to run. Left out: the published one. "draft": its unpublished draft (the published version when it has none), to try changes before publishing them. A number: that earlier version. A version the agent doesn’t have is a 404. Only admins and API keys can pick one (a draft or an older version can have looser guardrails): anyone else gets a 403 with code version_not_allowed.
x >= 12
Response
OK
computer for a task on a computer or a cloud browser; chat for a run of a chat procedure in a conversation (its steps without AI, the model following it, or both). A chat run's events are what it did, and cost_cents is what its replies came to; it is never charged on its own, its replies are.
computer, chat The conversation where its questions and approvals are asked and decided: the chat’s, for a task an agent started from a conversation, or one of its own (with its agent, holding the task) for a task started directly. Decide in it with POST /v1/conversations/{conversation_id}/decisions. Null for tasks from before every task had one.