You need an agent that can open an app, fill a form, navigate between tabs, and then return to the same state to continue. Stateless predict works fine for one-shot tasks, but it lacks memory across steps. The stateful sessions API adds trajectory memory so the model remembers the full history of screens and actions. This lets you build complex workflows that feel like a human user instead of a script.
How it works
The stateless predict endpoint is POST /v1/predict. It takes a base64 screenshot, an instruction, and a cua_version. It returns actions and a status. You loop capture, predict, act until status is done. Price is $0.05 per call. The session-based approach is different. First, you create a session with POST /v1/sessions. The response includes an id. Then you call POST /v1/sessions/{id}/predict. Each call now includes the session id and optionally the previous conversation history. The server keeps the trajectory in memory. Price is $0.04 per predict call. This model remembers the full sequence of screens and actions, so later steps can reason about earlier ones.
curl -X POST https://coasty.ai/v1/sessions \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "aws-ubuntu-22-04",
"cua_version": "v4"
}'
# Response:
# {
# "id": "sess_abc123",
# "machine_id": "aws-ubuntu-22-04",
# "cua_version": "v4",
# "created_at": "2025-01-20T12:00:00Z"
# }When to use stateless predict
- Simple one-shot tasks like clicking a button and submitting a form.
- You want to minimize latency and avoid storing history.
- You only need a single prediction per task.
When to use stateful sessions
- Complex workflows with multiple steps and branching logic.
- You need the model to reason about earlier screens or actions.
- You want to resume a session later with GET /v1/sessions/{id}.
- You plan to integrate with workflows that use session ids as variables.
Stateful sessions cost $0.04 per predict call and give you trajectory memory built into the API.
Where this beats brittle automation
Traditional automation relies on selectors, XPath, or API wrappers. Those break when layouts change or elements are dynamically generated. A computer use agent sees the screen and acts like a human. It reads text, understands context, and adapts to layout shifts. With stateful sessions, the agent remembers the full sequence of screens, so it can cross-reference earlier states and make smarter decisions. This makes your automation resilient to UI changes and reduces maintenance overhead.
Pick stateless predict for quick, single-step tasks and stateful sessions for workflows that need memory. Start building a session-based agent now. Get your API key at https://coasty.ai/developers.
Want to see this in action?
View Case Studies