{"id":3871,"library":"anyscale","title":"Anyscale CLI and SDK","description":"Anyscale is a Python library and CLI that provides programmatic tools for authenticating and interacting with the Anyscale platform. It simplifies the deployment and scaling of machine learning models, particularly those involving large language models (LLMs), by enabling interaction with Anyscale's cloud infrastructure from Python applications or the command line. The library is actively maintained, with frequent updates, and the current version is 0.26.93.","status":"active","version":"0.26.93","language":"en","source_language":"en","source_url":"https://docs.anyscale.com/","tags":["CLI","SDK","MLOps","Cloud Platform","Ray","AI/ML"],"install":[{"cmd":"pip install anyscale","lang":"bash","label":"Install core library"},{"cmd":"pip install anyscale[azure]","lang":"bash","label":"Install with Azure extras"},{"cmd":"pip install anyscale[gcp]","lang":"bash","label":"Install with GCP extras"}],"dependencies":[{"reason":"Runtime environment","package":"python","optional":false}],"imports":[{"note":"The legacy AnyscaleSDK class is deprecated and will be removed. Direct import of the 'anyscale' package and access to its submodules/functions is the recommended pattern.","wrong":"from anyscale.sdk import AnyscaleSDK\nsdk = AnyscaleSDK()\njobs = sdk.job.list()","symbol":"anyscale","correct":"import anyscale\njobs = anyscale.job.list()"}],"quickstart":{"code":"import os\nimport anyscale\n\n# Ensure you have logged in via `anyscale login` or set ANYSCALE_CLI_TOKEN\n# For non-interactive use, generate an API key from the Anyscale console\n# and set it as an environment variable.\n# os.environ['ANYSCALE_CLI_TOKEN'] = os.environ.get('ANYSCALE_CLI_TOKEN', '')\n\n# List Anyscale jobs\ntry:\n    print(\"Listing Anyscale jobs...\")\n    jobs = anyscale.job.list(max_items=5)\n    if jobs.results:\n        for job in jobs.results:\n            print(f\"  Job ID: {job.id}, Name: {job.name}, State: {job.state}\")\n    else:\n        print(\"  No Anyscale jobs found.\")\nexcept Exception as e:\n    print(f\"Error listing jobs: {e}\")\n    print(\"Please ensure you are authenticated. Run `anyscale login` or set the ANYSCALE_CLI_TOKEN environment variable.\")","lang":"python","description":"This quickstart demonstrates how to programmatically list Anyscale jobs using the SDK. Before running this code, you must authenticate the Anyscale CLI by running `anyscale login` in your terminal or by setting the `ANYSCALE_CLI_TOKEN` environment variable for non-interactive environments."},"warnings":[{"fix":"Replace `from anyscale.sdk import AnyscaleSDK; sdk = AnyscaleSDK()` with `import anyscale` and call methods like `anyscale.job.list()`.","message":"The legacy `AnyscaleSDK` class is deprecated and will be removed by February 28, 2026. Migrate to directly importing `anyscale` and using `anyscale.<module>.<function>()`.","severity":"breaking","affected_versions":"0.26.86 and earlier"},{"fix":"Consult the Anyscale CLI documentation for the equivalent new commands, e.g., use `anyscale image` for image management and `anyscale workspace_v2` for workspace operations.","message":"Legacy CLI commands like `anyscale cluster-env`, `anyscale cluster start/terminate`, and `anyscale machine list/delete` have been removed. Use `anyscale image` and `anyscale workspace_v2` commands instead.","severity":"breaking","affected_versions":"0.26.77 and later"},{"fix":"Upgrade your Python environment to version 3.9 or higher (up to <3.14).","message":"Support for Python 3.8 was removed starting in Anyscale CLI version 0.26.75.","severity":"breaking","affected_versions":"0.26.75 and later"},{"fix":"Replace calls to `anyscale cloud edit` with `anyscale cloud update`.","message":"The `anyscale cloud edit` command is deprecated. Use `anyscale cloud update` instead.","severity":"deprecated","affected_versions":"0.26.81 and later"},{"fix":"Update SDK code to use the new `anyscale.cloud` module methods.","message":"Legacy cloud SDK methods `get_cloud`, `get_default_cloud`, and `search_clouds` have been removed. Use `anyscale.cloud.get`, `anyscale.cloud.get_default`, and `anyscale.cloud.list` respectively.","severity":"deprecated","affected_versions":"0.26.85 and later"},{"fix":"Always explicitly set the `max_retries` parameter when submitting Anyscale jobs to avoid unexpected behavior changes in future releases.","message":"The default value for `max_retries` when submitting jobs will change from 1 to 0 in a future release. Explicitly set `max_retries` for consistent behavior.","severity":"gotcha","affected_versions":"All versions, proactive change recommended"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}