# Ray

> Scale Python and ML workloads from a laptop to a cluster with one framework

- Category: Models & Inference / GPU & Compute Clouds
- Language: Python
- Repository: https://github.com/ray-project/ray
- Website: https://www.ray.io
- Canonical page: https://ai-tldr.dev/tools/ray/
- Updated: 2026-08-23

## In short

Ray is an open-source framework for scaling Python and AI applications. It sits in the GPU & Compute Clouds category of the Models & Inference tools and is open-source, written in Python. To get started: install Ray.

## Overview

Ray is an open-source framework for scaling Python and AI applications. It pairs a core distributed runtime with a set of higher-level AI libraries, so you can run the same code on a laptop and then on a cluster without rewriting it or managing extra infrastructure yourself.

It is aimed at Python and ML engineers who hit the limits of a single machine. The core gives you three building blocks: Tasks (stateless functions run across the cluster), Actors (stateful worker processes), and Objects (immutable values shared across the cluster). On top of that sit libraries for data, training, tuning, reinforcement learning, and serving.

As a compute-orchestration tool, Ray runs on any machine, cloud provider, or Kubernetes. It fits teams that want one way to distribute training, hyperparameter tuning, batch data jobs, and online model serving rather than stitching together separate systems for each.

## What it does

- Core distributed runtime with three primitives: Tasks (stateless functions), Actors (stateful workers), and Objects (shared immutable values)
- Ray Data for scalable datasets and batch processing across a cluster
- Ray Train for distributed model training
- Ray Tune for scalable hyperparameter tuning
- Ray Serve for programmable model and application serving, plus RLlib for reinforcement learning
- Runs on any machine, cloud provider, or Kubernetes, with a Ray Dashboard and distributed debugger for monitoring

## Getting started

Install Ray from PyPI, then use the core API to run Python functions across the cluster.

1. Install Ray

   Install the package from PyPI. For nightly wheels, see the Ray installation page in the docs.

```bash
pip install ray
```

2. Run a task on the cluster

   Decorate a Python function with @ray.remote to turn it into a Task, call it with .remote(), and collect results with ray.get(). Ray starts a local runtime automatically when you call ray.init().

```python
import ray

ray.init()

@ray.remote
def square(x):
    return x * x

futures = [square.remote(i) for i in range(4)]
print(ray.get(futures))  # [0, 1, 4, 9]
```

3. Explore the AI libraries

   Once Ray Core works, layer on the higher-level libraries (Data, Train, Tune, RLlib, Serve) for distributed data processing, training, tuning, and serving. See the Ray documentation for each library's quickstart.

## When to use it

- Scale an existing Python script from a laptop to a cluster without rewriting it for new infrastructure
- Run distributed model training and hyperparameter tuning with Ray Train and Ray Tune
- Process large datasets in parallel with Ray Data as a batch compute layer
- Serve models and applications online with Ray Serve

## Version history

- 2026-08-23 2.58.0: Ray 2.58.0 finishes KV-cache- and token-aware request routing for Ray Serve LLM: the router tokenizes inside its own ingress replica and passes tokens out-of-band, so the engine never tokenizes twice.
