Skip to main content
Every RasterFlow workflow is a task in the Tasks API. You start a task run, wait for it to finish, then read its output.

Run a task

Inside a Wherobots notebook or job, the Wherobots Python SDK uses your Wherobots credentials. Anywhere else, set a Wherobots API key in WHEROBOTS_API_KEY. The SDK needs Python 3.11 or later.

Run states

A run starts as PENDING, and is still in progress while its state is PENDING, SUBMITTED, RUNNING or CANCELLING. When a run stops, read its state:
  • SUCCEEDED: results holds the task’s output.
  • Any other final state: error_message says why.
In the Python SDK, run_and_wait polls the run until it stops, every 5 seconds at first and then less often, up to every 30 seconds. When the run succeeds, read its named outputs from run.results. For a task with a single output, run.output returns that value. Any other final state raises wherobots.WherobotsTaskRunError with the run’s error_message. Stopping the wait, with Ctrl-C or max_wait_seconds, doesn’t stop the run: resume waiting with wb.task_runs.wait_for_completion(task_run_id), or stop the run with wb.task_runs.cancel(task_run_id). A run’s state can lag the run by up to two minutes, so over REST, poll every 30 seconds or so rather than in a tight loop. If you pass inputs that don’t match the task’s input schema, the API rejects the run with a 400 error before anything is launched or billed.

Task run results

When a run succeeds, results holds its named outputs. Most tasks return a single URI: The recipe tasks, predict_mosaic_recipe and predict_mosaic_geometries_recipe, each return input_mosaic and a task-specific prediction output:
  • input_mosaic: the imagery the run built. mosaic_index_uri is its mosaic index, and first_row_mosaic is the first Zarr store in it.
  • prediction_mosaic holds the prediction mosaic from predict_mosaic_recipe. Its mosaic_index_uri points to the prediction index.
  • detection_geometries holds the GeoParquet directory URI from predict_mosaic_geometries_recipe, or null when nothing cleared the confidence threshold.
In the Python SDK, read the predictions with run.results["prediction_mosaic"]["mosaic_index_uri"] for predict_mosaic_recipe, and run.results["detection_geometries"] for predict_mosaic_geometries_recipe. To download an output from outside Wherobots, see Download a task run’s results.

Areas of interest

For mosaic builds, inference recipes, and mosaic change detection, pass the area of interest in aoi. The value can be an S3 URI of a GeoParquet or GeoJSON file, or a polygon or multipolygon WKT string with longitude/latitude coordinates in EPSG:4326. You do not need to upload a file to use inline WKT. For mosaic builds with inline WKT, also supply target_crs for the output grid.

Choose NAIP resolution for SAM3

When you run predict_mosaic_geometries_recipe with sam3-text-geometry (polygons) or sam3-text-bbox (bounding boxes), you can omit naip_resolution or set it to "auto". The recipe uses one native NAIP RGB resolution for the whole run. It prefers 30 cm and uses 60 cm when only 60 cm qualifies. For each AOI feature, the recipe checks every year with imagery on that feature between start and end, inclusive. The same resolution must cover the entire feature and at least 90% of the surrounding area the model reads, including the feature. If different features or years need different resolutions, split the request by the rows or years listed in the error. If a feature has no imagery in the interval, change the dates or the area. To keep the College Park example at 30 cm, add this field to its inputs object. Use "60cm" for an area and date range with native 60 cm coverage.

Find a task’s inputs and outputs

Each task describes itself. With the Python SDK, wb.tasks.get(...) returns its description, input_schema, output_schema and examples:
wb.tasks.list() lists every task your Organization can run. If your list includes run_mosaics_change, use alpha_earth_cosine_distance for AlphaEarth Foundations embeddings. For floating-point embeddings, choose cosine_distance or euclidean. See the task’s input schema for the scoring defaults. The Tasks API reference documents the endpoints these calls use, including Get a task and List tasks. It doesn’t list each task’s inputs: those come from the task itself, in the inputSchema that Get a task returns, so they always match what the task accepts.

Region

Pass region="aws-us-west-2" (or "region": "aws-us-west-2" with the REST API) on every run. Without it, the run uses your Organization’s default region.
During Public Preview, RasterFlow is available in aws-us-west-2. If you’re interested in running RasterFlow in another region, contact Wherobots.