ml-agents README

The project's README from github.com/Unity-Technologies/ml-agents. As one markdown file: README.md.

Unity ML-Agents Toolkit

docs badge

license badge

(latest release) (all releases)

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents. We provide implementations (based on PyTorch) of state-of-the-art algorithms to enable game developers and hobbyists to easily train intelligent agents for 2D, 3D and VR/AR games. Researchers can also use the provided simple-to-use Python API to train Agents using reinforcement learning, imitation learning, neuroevolution, or any other methods. These trained agents can be used for multiple purposes, including controlling NPC behavior (in a variety of settings such as multi-agent and adversarial), automated testing of game builds and evaluating different game design decisions pre-release. The ML-Agents Toolkit is mutually beneficial for both game developers and AI researchers as it provides a central platform where advances in AI can be evaluated on Unity’s rich environments and then made accessible to the wider research and game developer communities.

Features

Releases & Documentation

⚠️ Documentation Migration Notice We have moved to Unity Package documentation as the primary developer documentation and have deprecated the maintenance of web docs. Please use the Unity Package documentation for the most up-to-date information.

The table below shows our latest release, including our develop branch which is under active development and may be unstable. A few helpful guidelines:

Version Release Date Source Documentation Download Python Package Unity Package
Release 23 August 28, 2025 source docs download 1.1.0 4.0.0
develop (unstable) -- source docs download -- --

If you are a researcher interested in a discussion of Unity as an AI platform, see a pre-print of our reference paper on Unity and the ML-Agents Toolkit.

If you use Unity or the ML-Agents Toolkit to conduct research, we ask that you cite the following paper as a reference:

@article{juliani2020,
  title={Unity: A general platform for intelligent agents},
  author={Juliani, Arthur and Berges, Vincent-Pierre and Teng, Ervin and Cohen, Andrew and Harper, Jonathan and Elion, Chris and Goy, Chris and Gao, Yuan and Henry, Hunter and Mattar, Marwan and Lange, Danny},
  journal={arXiv preprint arXiv:1809.02627},
  url={https://arxiv.org/pdf/1809.02627.pdf},
  year={2020}
}

Additionally, if you use the MA-POCA trainer in your research, we ask that you cite the following paper as a reference:

@article{cohen2022,
  title={On the Use and Misuse of Absorbing States in Multi-agent Reinforcement Learning},
  author={Cohen, Andrew and Teng, Ervin and Berges, Vincent-Pierre and Dong, Ruo-Ping and Henry, Hunter and Mattar, Marwan and Zook, Alexander and Ganguly, Sujoy},
  journal={RL in Games Workshop AAAI 2022},
  url={http://aaai-rlg.mlanctot.info/papers/AAAI22-RLG_paper_32.pdf},
  year={2022}
}

Additional Resources

Community and Feedback

The ML-Agents Toolkit is an open-source project and we encourage and welcome contributions. If you wish to contribute, be sure to review our contribution guidelines and code of conduct.

For problems with the installation and setup of the ML-Agents Toolkit, or discussions about how to best setup or train your agents, please create a new thread on the Unity ML-Agents discussion forum. Be sure to include as many details as possible to help others assist you effectively. If you run into any other problems using the ML-Agents Toolkit or have a specific feature request, please submit a GitHub issue.

Please tell us which samples you would like to see shipped with the ML-Agents Unity package by replying to this discussion thread.

Privacy

In order to improve the developer experience for Unity ML-Agents Toolkit, we have added in-editor analytics. Please refer to "Information that is passively collected by Unity" in the Unity Privacy Policy.

ml-agents (Unity-Technologies/ml-agents)

Searching Database…

19.8K ·GitHub
这是什么?Unity ML-Agents Toolkit 让 Unity 游戏和模拟环境可以作为 AI 智能体的训练环境,使用深度强化学习和模仿学习。它将 Unity SDK 与 Python API 结合起来,让游戏开发者和研究人员可以训练 NPC、测试构建版本,或评估设计决策。
这是 Unity 包、Python 库,还是两者都是?两者都是——一个灵活的 Unity SDK,可以集成到你的游戏或自定义 Unity 场景中;再配合一个 Python 包,由它运行实际的强化学习和模仿学习训练,并通过 Python API 与 Unity 环境通信。
我该如何在自己的项目里运行它?通过 Unity Package Manager 添加 com.unity.ml-agents Unity 包(已在 Unity 2020.1+ 上验证),然后安装与之匹配的 mlagents Python 包,用它在你的场景中运行训练器。具体请参阅最新版本对应的 Unity Package 当前文档。
我需要单独配置 Python 和 PyTorch 吗?需要——训练通过一个单独的 Python 包运行,其中的算法(PPO、SAC、MA-POCA、BC、GAIL)基于 PyTorch 实现,与 C# 编写的 Unity 端 SDK 是分开的。
旧的网页文档还应该用吗?不建议——项目已经弃用网页文档;现在 Unity Package 文档是主要且最新的资料来源,并且明确标注 develop 分支不稳定。
这是面向游戏开发者、研究人员,还是两者都面向?两者都面向——游戏开发者可以获得用于 NPC 行为、自动化构建测试和设计评估的工具;研究人员则可以通过简单的 Python API,在 Unity 环境上尝试强化学习、模仿学习、神经进化,或他们自己的自定义算法。
这个工具会把任何数据发回 Unity 吗?会——Unity 包包含编辑器内分析功能,用于改善开发者体验,并受 Unity 通用隐私政策约束。
内置了哪些强化学习和模仿学习算法?强化学习方面有 PPO、SAC 和 MA-POCA(包括自我对弈,以及合作和竞争的多智能体设置);模仿学习方面有从演示中学习的 BC 和 GAIL。
我能否在原生 ML-Agents 工作流之外使用 Unity 环境?可以——你可以把 Unity 学习环境封装为 Gym 环境或 PettingZoo 环境,接入其他强化学习库。
有没有可以用来学习的示例环境?有——该工具附带 17 个以上的 Unity 示例环境,涵盖单智能体、合作和竞争型多智能体训练场景。
Size
2.9 GB
Stars
19.8K
Age
9y
Commits · 90 Days