arazzo: 1.0.1
info:
title: Onfleet Auto-Assign Task
summary: Create a task with auto-assignment to a team, then confirm a worker was assigned.
description: >-
Lets Onfleet's routing engine pick the best driver instead of assigning
manually. The workflow creates a dropoff task with an autoAssign block scoped
to a team, then reads the task back and branches on the result: when a worker
was selected it captures the assignment, and when the task remains
unassigned it surfaces that the task is still waiting in the queue. Every
step spells out its request inline so the flow can be read and executed
without opening the underlying OpenAPI descriptions.
version: 1.0.0
x-realizes-capability-ids:
- BC-2420.40
x-capability-derivation:
method: 'deterministic join: sourceDescriptions -> per-tag OpenAPI -> tag/capability edge. No classification at this step.'
min_confidence: 0.7
sources:
- capability_id: BC-2420.40
capability_name: Last-Mile Delivery Operations Management
spec: onfleet-tasks-api-openapi.yml
confidence: 0.8
model: Turbo EA Capabilities by Vincent Verdet — Turbo EA, https://github.com/vincentmakes/turbo-ea-capabilities, CC BY 4.0
sourceDescriptions:
- name: tasksApi
url: ../openapi/onfleet-tasks-api-openapi.yml
type: openapi
workflows:
- workflowId: auto-assign-task
summary: Create an auto-assigned task and verify whether a worker was selected.
description: >-
Creates a task with team-scoped auto-assignment and inspects the resulting
task to confirm whether a worker was assigned.
inputs:
type: object
required:
- teamId
- unparsedAddress
properties:
teamId:
type: string
description: The team id to auto-assign the task within.
unparsedAddress:
type: string
description: A single-line street address Onfleet will geocode.
mode:
type: string
description: Auto-assign mode, either "distance" or "load".
completeBefore:
type: integer
description: Latest completion time in Unix milliseconds.
taskNotes:
type: string
description: Optional notes shown to the assigned worker.
steps:
- stepId: createAutoAssignedTask
description: Create a task that asks Onfleet to auto-assign a worker on the team.
operationId: createTask
requestBody:
contentType: application/json
payload:
destination:
address:
unparsed: $inputs.unparsedAddress
completeBefore: $inputs.completeBefore
notes: $inputs.taskNotes
autoAssign:
mode: $inputs.mode
team: $inputs.teamId
successCriteria:
- condition: $statusCode == 200
outputs:
taskId: $response.body#/id
- stepId: confirmAssignment
description: Read the task back to determine whether a worker was assigned.
operationId: getTask
parameters:
- name: taskId
in: path
value: $steps.createAutoAssignedTask.outputs.taskId
successCriteria:
- condition: $statusCode == 200
outputs:
worker: $response.body#/worker
state: $response.body#/state
onSuccess:
- name: assigned
type: end
criteria:
- condition: $response.body#/worker != null
- name: stillUnassigned
type: goto
stepId: reportUnassigned
criteria:
- condition: $response.body#/worker == null
- stepId: reportUnassigned
description: Re-read the task to surface that it is still unassigned (state 0).
operationId: getTask
parameters:
- name: taskId
in: path
value: $steps.createAutoAssignedTask.outputs.taskId
successCriteria:
- condition: $statusCode == 200
outputs:
state: $response.body#/state
outputs:
taskId: $steps.createAutoAssignedTask.outputs.taskId
assignedWorker: $steps.confirmAssignment.outputs.worker
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.