Interact5 min read
Introducing interact: continue a phone app task in plain words
Lusor's interact call picks up where a scrape or agent task left off. Send the next instruction in plain words, an AI agent carries it out on the same phone, and you read the answer as text. Here is how to send a turn, read it and stop.
By Josiah Richards
TL;DR
- POST /v1/interact/{id} sends the next instruction for the screen a scrape or agent task ended on. An AI agent carries it out on the same phone.
- Read the turn with GET /v1/interact/{id} while its status is processing. output is the answer as text.
- POST /v1/interact/{id}/stop asks the turn to stop. If it answers stopping, keep reading the turn until it ends. noop means it found nothing it could cancel. Each stop acts on the task's latest run.
- The phone isn't held between turns. A busy phone answers 429 device_busy, and a turn sent while the task is still running answers 409 task_running.
- Interact is in the REST API today. Interact methods aren't in the published SDKs yet, and turns take a prompt, not a script.
A scrape reads an app page, and an agent task ends on the screen where it found its answer. Often the next thing you want is one step further: open the most recent order on the list you just read, or read one more field on the screen the agent left open. Lusor's interact call sends that next step in plain words. An AI agent carries it out on the same phone, and you read the answer as text.
Interact follows Firecrawl's interact call: a turn continues an earlier task by its id, and stop asks it to stop. Interact is in the REST API today; interact methods aren't in the published SDKs yet. The interact docs have every field.
What do you need before a turn?
A task. Interact takes the id that scrape or agent returned, and any other id is a 404. There is no interact call on an address: to start at a particular screen, scrape that screen first.
curl "https://api.lusor.ai/v1/scrape" \
-H "X-Api-Key: $LUSOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "app://com.mycompany.shop/orders", "formats": ["markdown"], "maxScreens": 1 }'maxScreens: 1 keeps the scrape on the screen the address reaches. The scrape answers with its task id. Set TASK_ID to it and wait until the scrape reads completed: a turn sent while the task is still running is refused. How scrape reads a screen is in scrape a phone app like a web page, and how an agent task finds one is in introducing agent for phone apps.
How do you send a turn?
Send the next instruction as prompt, up to 8,192 characters, to POST /v1/interact/{id}.
curl "https://api.lusor.ai/v1/interact/$TASK_ID" \
-H "X-Api-Key: $LUSOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "prompt": "Open the most recent order and read its status." }'The call answers 202 at once. The turn continues the task's own session, so the id it answers is the task's id.
{
"id": "8b2d4f71-…"
}Read GET /v1/interact/{id} while status is processing. With jq:
while :; do
RESULT=$(curl -s "https://api.lusor.ai/v1/interact/$TASK_ID" -H "X-Api-Key: $LUSOR_API_KEY")
case "$(echo "$RESULT" | jq -r .status)" in
processing) sleep 3 ;;
*) break ;;
esac
done
echo "$RESULT" | jq .What does a turn return?
{
"success": true,
"status": "completed",
"output": "Order #1042 is out for delivery.",
"recordingUrl": "https://api.lusor.ai/v1/sessions/8b2d4f71-…/recording",
"error": null
}output is the turn's answer as text, or null when the turn wrote none. A task that started with a schema answers that object as JSON text. error says why a turn failed, and creditsUsed is what the task has been charged so far, the run that started it and every turn included.
A turn reads awaiting_human when the agent stopped to ask a question. Answer it with the task id, on a scrape or an agent task, and the turn carries on; see answer the agent. Reading the scrape itself during a turn, or after it, still returns the scrape's own document.
How do you stop?
curl -X POST "https://api.lusor.ai/v1/interact/$TASK_ID/stop" \
-H "X-Api-Key: $LUSOR_API_KEY"Stop asks the turn on the task's phone to stop. It answers success, a status and sessionDurationMs, the time since the stopped run took the phone, or 0 when it never took the phone or the stop answered noop. stopping means cancellation was requested, so keep reading the turn until it ends before you send the next one. cancelled means a turn that was waiting for a reply is now ended. noop means the stop found no run it could cancel; a scrape or agent task still waiting for its phone answers noop too and can still start. Each stop acts on the task's latest run, so a later stop can cancel a turn you sent after the first one.
What happens to the phone between turns?
Lusor doesn't hold the phone between turns. Each turn takes it again, so no phone time is charged in between, and a later turn on the same id still works. Another task on the same phone in between can change the screen, so send the next turn when you want it.
| Meaning | |
|---|---|
| 409 task_running | The task's own run or an earlier turn is still going. Wait for it to end, then send the turn with a new Idempotency-Key. |
| 429 device_busy | The phone is running another task. Try again when it frees. |
| 400 code_not_supported | The body sent code. Turns take a prompt for now. |
| 404 not_found | No scrape or agent task with this id in the key's workspace. |
Use a new Idempotency-Key for each new turn. If you can't tell whether a turn was accepted, retry with the same key. The request is checked again, and if it reaches the phone while the first result is still kept, it answers that result instead of starting a second turn. After 409 task_running or 429 device_busy, wait for the task or the phone to free up, then send the turn with a new key.
What isn't there yet?
- Scripts. A turn takes a plain-words
prompt. A body withcodeanswers400 code_not_supported. - SDK methods. Interact is in the REST API. Interact methods aren't in the published SDKs yet.
- Recording of turns.
recordingUrlis the recording of the task that started it. Turns themselves aren't recorded yet, and a turn has no live view link. - A screen document from a turn. A turn answers text. To read a screen in a set format, use scrape.
Scrape, map, agent and interact are the four app-data calls Lusor runs today; search and crawl are not available yet. Every field, status and error code is in the interact docs, next to the scrape, map and agent docs.
Frequently asked questions
What does Lusor's interact call do?
It continues a scrape or agent task on the screen the task ended on. You send the next instruction in plain words, an AI agent carries it out on the same phone, and you read the answer as text. You can send as many turns as you need, then stop.
Can you call interact without a scrape or agent task first?
No. Interact takes the id of a task scrape or agent returned, and any other id is a 404. To start at a particular screen, scrape that screen first and continue its task.
Does Lusor hold the phone between interact turns?
No. Each turn takes the phone again, so no phone time is charged in between, and a later turn on the same id still works. Another task on the same phone in between can change the screen. A phone busy with another task answers 429 device_busy.
What does task_running mean on an interact turn?
The task's own run, or an earlier turn, is still going. Wait for it to end before you send the turn again. If you asked it to stop, keep reading the turn until it ends. Send the next turn with a new Idempotency-Key.
Can an interact turn run a script?
Not yet. A turn takes a plain-words prompt. A body with code answers 400 code_not_supported.