Run a task on a phone
Starts one run on a phone and returns its id. The task is a session:
the id is the session id, so GET /v1/agent/{id} answers its status
and result, and /v1/sessions/{id} describes the same run.
The phone is the workspace’s only phone when it has one. A workspace
with several phones passes device; without it the request is a
400 that lists the ids to choose from. A task holds its phone for
its duration. A phone already running another task queues this one:
it reads processing and starts when the phone frees, and its result’s
metadata then reports concurrencyLimited and
concurrencyQueueDurationMs. A task still waiting after 15 minutes
fails with queue_expired without starting, and nothing is charged.
schema asks for the final answer as the object that JSON Schema
describes.
curl --request POST \
--url https://api.lusor.ai/v1/agent \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"prompt": "<string>",
"schema": {},
"device": "<string>",
"workspaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expiresIn": 31,
"maxCredits": 10000
}
'const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
schema: {},
device: '<string>',
workspaceId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
expiresIn: 31,
maxCredits: 10000
})
};
fetch('https://api.lusor.ai/v1/agent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.lusor.ai/v1/agent"
payload = {
"prompt": "<string>",
"schema": {},
"device": "<string>",
"workspaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expiresIn": 31,
"maxCredits": 10000
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"liveViewUrl": "<string>"
}{
"error": "device_required",
"message": "<string>",
"devices": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "device_busy",
"currentSessionId": "<string>",
"message": "<string>"
}Authorizations
Headers
Body
The most credits this run may spend. The run stops once its
charge would pass it: the task ends failed with
stopReason: "credit_limit_reached" and is charged at most
maxCredits. Without it a default cap applies; pass a higher or
lower number to replace it. Applies to this run, not to later
interact turns.
1 <= x <= 999999999999999Response
Task accepted
A link to watch this run's phone live, with no Lusor login: a bare player page you can embed in an iframe. It is watch-only (its stream carries video only and the server refuses taps, typing and keys for it), and it opens for this run only. Omitted when the run is not recording or the phone cannot serve it.
Was this page helpful?
curl --request POST \
--url https://api.lusor.ai/v1/agent \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"prompt": "<string>",
"schema": {},
"device": "<string>",
"workspaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expiresIn": 31,
"maxCredits": 10000
}
'const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
schema: {},
device: '<string>',
workspaceId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
expiresIn: 31,
maxCredits: 10000
})
};
fetch('https://api.lusor.ai/v1/agent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.lusor.ai/v1/agent"
payload = {
"prompt": "<string>",
"schema": {},
"device": "<string>",
"workspaceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expiresIn": 31,
"maxCredits": 10000
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"liveViewUrl": "<string>"
}{
"error": "device_required",
"message": "<string>",
"devices": [
"<string>"
]
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "device_busy",
"currentSessionId": "<string>",
"message": "<string>"
}
