# thu-ml/tianshou

An elegant PyTorch deep reinforcement learning library.

Repository: https://github.com/thu-ml/tianshou
Canonical: https://ross.abutalabs.com/products/tianshou
Homepage: https://tianshou.org
Language: Python
License: MIT
License Family: permissive
Topics: pytorch, policy-gradient, dqn, double-dqn, a2c, ddpg, ppo, td3, sac, imitation-learning, mujoco, atari, bcq, rl, drl, trpo, npg, cql, transferlab
Last push: 2026-04-03T21:34:47+00:00

## Health v2 (maintenance only)
Score: 72/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 75, release rhythm 53, longevity 100
- inputs: {"age_days": 3061, "days_push": 152, "days_rel": 153, "gap_med": 141.0, "n_releases_24m": 3}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 10943, forks 1333 (observed 2026-08-28T04:10:44.785602+00:00)

## What it is
Tianshou is a modular, high-performance deep reinforcement learning library built on pure PyTorch and Gymnasium. It offers both low-level hackable interfaces for RL researchers and high-level APIs for training agents, covering online, offline, and experimental multi-agent and model-based RL.

## Use cases
- train a deep RL agent on a custom Gymnasium environment
- implement and benchmark policy gradient algorithms like PPO or SAC
- run offline RL experiments with CQL or BCQ
- prototype new RL algorithms with modular PyTorch components
- train DQN variants on Atari environments
- apply imitation learning such as GAIL or behavior cloning

## When to choose
- you want a fast, pure-PyTorch RL library with clean, type-safe APIs
- you need broad algorithm coverage across on-policy, off-policy, and offline RL
- you are an RL researcher who needs hackable modular interfaces
- you want well-documented trainers for custom environments

## When to avoid
- you need TensorFlow-based RL tooling
- you need production multi-agent RL support (still experimental)
- you depend on Tianshou v1 APIs, since v2 is not backwards compatible
- you want a turnkey RL platform with no coding

## Facets
- artifact type: library
- maturity: active
- function: machine-learning, reinforcement-learning, deep-learning
- domain: reinforcement-learning, machine-learning, deep-learning
- platform: python, cross-platform
- tags: pytorch, gymnasium, dqn, ppo, sac, offline-rl, imitation-learning, multi-agent-rl

## Member repositories
- thu-ml/tianshou (main) score 72

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:44.785602+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:17:19.138629+00:00, confidence not recorded.
  - readme: https://github.com/thu-ml/tianshou (fetched 2026-08-28T04:10:44.785602+00:00, sha f9b1fd7d2676)
  - homepage: https://tianshou.org (fetched 2026-08-29T08:16:04.993683+00:00, sha ba01ce393d88)
  - registry_pypi: https://pypi.org/pypi/tianshou/json (fetched 2026-08-29T08:16:05.003167+00:00, sha aa2a2d9d6618)
- Data as of 2026-08-30T08:39:29.467469+00:00.
