Skip to main content

Quickstart

Create a deployment key in the API Keys panel of your Sutro UI, then configure the deployment before running these examples: If the panel is not visible, contact the Sutro team at [email protected] to create a key for you.
The SDK accepts either the Sutro deployment base URL or the same URL with /v1 appended. You can persist the same values with sutro login instead.

Using the Python SDK

Here’s the simplest way to run a job with Sutro - just pass a list of inputs and a system prompt.
This outputs a list preserving the original ordering:
Below are some more complex examples that show different ways to use Sutro!

Structuring outputs

In the above example, we’re trying to perform a simple classification task. In such cases, we may want structured outputs. We can accomplish this by passing in a Pydantic model or JSON schema using the output_schema parameter. The model will strictly adhere to this schema in its output content.
Now we should obtain the following output:
Structured outputs also work well with reasoning models, since the model has the token space to go through a reasoning process before its outputs get constrained to the output schema.

Working with DataFrames and Sampling Parameters

This example shows how to work with DataFrames, customize sampling parameters, and wait for job completion.

Multi-Model Comparison

Run the same inputs across multiple models to compare outputs and quality.

Cost Estimation

Before submitting production work, inspect your row and token quotas with so.get_quotas() or sutro quotas. See Increasing Quotas if the input exceeds your priority-1 limits. You can request an estimate with dry_run=True. The SDK prints the estimate and returns the estimate job ID; it does not return the estimate value.

Using Files

You can also use files to pass in data. We currently support CSV, Parquet, and TXT files. If you’re using a TXT file, each line should represent a single input. If you’re using a CSV or Parquet file, you must specify the column name that contains the inputs using the column parameter.
You can view the full details of the SDK at here.

Moving to Production

So far we’ve shown prototyping jobs (priority 0, the default). For a production job, use priority 1 and give Sutro a presigned HTTPS GET URL for a private Parquet object in Amazon S3. This keeps the submission request small and avoids loading the full production dataset into the SDK process. Install Boto3 if your signing environment does not already include it:
Have your producer upload to a unique, immutable key. In production, use a separate read-only signing identity with s3:GetObject; the producer identity needs s3:PutObject. If bucket versioning is enabled, capture the uploaded version ID and follow the version-pinning example in Presigned S3 Inputs.
The job ID is returned immediately. Persist it before continuing. For a production-sized result set, poll without loading the complete JSON result into the SDK process:
obtain_results=False returns None for success, failure, cancellation, and timeout, so confirm SUCCEEDED as shown. Then request a Parquet download URL from GET /jobs/{job_id}/results-url?format=parquet and download urls.get; see Presigned Results URLs. S3 evaluates expiration when a request starts, and a download started before expiration can finish afterward. Sutro currently issues one full-object GET and does not resume a failed input download; inspect the original job before creating a fresh URL and replacement job. Treat the full URL as a temporary credential, keep it out of logs and source control, and retain the immutable source object until results are reconciled. For version pinning, KMS permissions, retention, and troubleshooting guidance, see Presigned S3 Inputs.

Using the CLI to view job progress and results

Once you’ve submitted jobs via the SDK or API, you can use the CLI to view the status of the job and retrieve the results. Viewing current and past jobs:
Retrieving job status:
Retrieving job results:
You can view the full details of the CLI at here.

API Usage Example

You can accomplish the same tasks using the API directly. You’ll need to preprocess data as a list or array and pass it in via the parameters in the JSON body.
For more details on using the API directly, refer to the Batch API Reference.