Execution Model
Phonefarm exposes a process-oriented public API, but the underlying runtime is a layered system.The Public Model
For callers, the lifecycle is:- Submit a request.
- Receive an accepted response.
- Observe
process.updatedcallbacks. - Poll the process record for current state.
- Cancel with a process-aware endpoint if needed.
The Internal Flow
Under the hood, the flow is:Key Objects
| Term | Meaning |
|---|---|
| Process | The public execution object returned to callers. Backed by capability_requests. |
| Capability | A higher-level unit of work such as keyword_warmup or maintenance. |
| Queue item | An internal execution record that the worker can claim and run. |
| Run container | An isolated worker container for one claimed queue item on one phone. |
| Callback | A best-effort push notification with normalized process state. |
Primary Public Entrypoints
Use these for new integrations:POST /capability-requests/enqueuePOST /maintenance/requestsGET /processes/{process_id}POST /processes/{process_id}/cancel
Compatibility Entrypoints
These older endpoints work directly with queue items:POST /ingestPOST /cancel
Routing Modes
Capability requests accept a target with one routing mode:| Routing mode | Meaning |
|---|---|
direct | Target a specific phone_id and account_id for immediate direct execution readiness. |
queue | Create work that will be materialized and claimed later. |
group | Fan out across explicit phone_ids and or account_ids. |
Run Modes
| Run mode | Meaning |
|---|---|
manual | Allowed for all currently implemented public capabilities. |
unattended | Allowed only for capabilities that are both permitted and live verified. |
fyp_warmup is implemented, but the current code still blocks it for unattended usage because it is manual_only, not live_verified.
Callbacks Versus Polling
Callbacks are useful for event-driven systems, but they are not the source of truth:- callbacks are best-effort
- callback failure does not fail the originating API request
- polling
GET /processes/{process_id}is the authoritative view