Anyscale API reference
This page provides an overview of the Anyscale APIs and provides links to API references.
What is an Anyscale API?
Anyscale APIs are a collection developer tools for programmatic interaction with the Anyscale platform. Most Anyscale APIs have the following three components:
Component | Description |
---|---|
CLI | A command line interface for running commands from a terminal or Bash script. See Anyscale CLI overview. |
SDK | A Python software development kit for interacting with Anyscale infrastructure from Python applications. See Anyscale Python SDK overview. |
Models | Objects that represent Anyscale components using structured fields and values, used with the CLI or SDK. See Models in the Anyscale API. |
The Anyscale platform is optimized for running Ray applications. Use the following Ray documentation to review the API reference for Ray Core and the Ray AI libraries:
Option naming for Anyscale APIs
Most options in the Anyscale CLI, SDK, and models use the following general rules for naming:
- The CLI uses feature flags for specifying options and hyphens for multi-word options. Some CLI commands provide optional positional arguments and have alternate short flags for command options.
- The SDK uses standard Python casing for classes, functions, and parameters.
- Most keywords in models share the same snakecase formatting for both the SDK and CLI.
The following table shows an example of specifying the working directory for a job or service:
CLI | SDK model | YAML config for CLI |
---|---|---|
--working-dir ./path | working_dir="./path" | working_dir: "./path" |
Anyscale CLI overview
The Anyscale command line interface (CLI) provides programmatic tools for authenticating and interacting with the Anyscale platform from the command line, Bash scripts, and other similar tooling. See CLI configuration.
Use the following links to navigate to CLI docs for common Anyscale features:
- Compute Config CLI
- Image CLI
- Workspaces CLI
- Service CLI
- Job CLI
- Schedule CLI
- Service Account CLI
- Cloud CLI
- Machine Pool CLI
- Resource Quotas CLI
- Aggregated Instance Usage CLI
- Logs CLI
Anyscale Python SDK overview
The Anyscale Python software develoment kit (SDK) provides a set of classes and methods to programmatically interact with features and products in the Anyscale platform. See Get started with the Anyscale SDK.
Some Anyscale APIs are available in the CLI but not the SDK. Contact Anyscale support to request new functionality.
Use the following links to navigate to SDK docs for common Anyscale features:
- Compute Config SDK
- Image SDK
- Workspaces SDK
- Service SDK
- Job SDK
- Schedule SDK
- Aggregated Instance Usage SDK
Models in the Anyscale API
Anyscale API models are data structures that define or describe Anyscale infrastructure.
Anyscale formats field names returned in response models to match field names in configuration models. You can use either the CLI or SDK to programmatically capture information about existing resources and reuse those fields and values to construct configuration models for other API calls.
The following table provides a high-level overview of configuration and response models for the SDK and CLI:
SDK | CLI | |
---|---|---|
Configuration | Use Python classes with keyword arguments to build out configurations for other SDK methods. | Use YAML config files to pass options to CLI commands in a structured format. |
Response | Use Python classes to capture the return from SDK methods in a structured format. | CLI commands return information about Anyscale assets structured as YAML. |
Models in the SDK have a to_dict()
method that allows you output the contents of a model formatted as a Python dict. The dict keys have the same names as keyword arguments for the model.
Use the following links to navigate to models for common API features: