Skip to main content

Real-time Functions

Use batch_run_function() instead for large tables; run_function() makes one synchronous request per call and can be rate limited. See Run a Function for the full request and response contract, limits, and error codes.

FunctionRunResult

The return value is a dict of the response payload, with its fields also available as attributes.

Assets

Image and PDF input fields take a value built by sutro.Image or sutro.Asset. Both return plain dicts, so they can also be written out by hand or serialized with json.dumps().
Image accepts image/png, image/jpeg, and image/webp; Asset also accepts application/pdf. Anything else raises ValueError before the request is sent.

Errors

run_function() never retries. Every failure raises a requests.HTTPError subclass carrying the deployment’s detail, code, and request_id.

Command line

--input takes a JSON object, or @ followed by the path to a file holding one. The command prints the JSON response and exits non-zero with the deployment’s detail on failure.