Unity ML-Agents
Train game agents and NPCs with machine learning in Unity

- Best for
- Unity developers who want NPCs or bots that learn behavior through training rather than hand-written scripts
- Makes
- Trained neural-network behaviors for agents and NPCs that run inside Unity scenes
- Made by
- Unity Technologies
- Where you use it
- Unity Editor, Windows, macOS, Linux
- Engines
- Unity
- Pricing
- Free, open source (self-hosted)
- Free plan
- Yes
- Open source
- Yes (Apache-2.0)
- Export
- Trained models are embedded back into the Unity scene and run through Unity's Sentis inference
- Status
- Available
Unity ML-Agents is Unity Technologies' open-source toolkit for training game characters with machine learning. You turn a Unity scene into a training environment and set up agents that gather observations through sensors, act, and are scored with rewards; a companion Python package does the actual training.
Unity's documentation lists PPO (the default) and SAC reinforcement learning, MA-POCA for cooperative multi-agent training, self-play for competitive games, curriculum learning, and two imitation learning methods, behavioral cloning and GAIL, that learn from demonstrations recorded in the Editor. The docs explain the toolkit through a hypothetical example: training a medic NPC in a war-themed multiplayer game. Trained models are embedded back into the scene and run through Sentis, Unity's inference engine.
The current package (version 4.2 in Unity's docs) needs Unity 6000.0 or later and Python 3.10. The install guide limits PyTorch to versions 2.1.1 through 2.8.0, because 2.9 and later break model export. ML-Agents is free under the Apache-2.0 license; GitHub shows the license as "Other" because the repo's LICENSE file is a short Apache notice rather than the full text. The most recent GitHub release, Release 23, is dated September 2, 2025.
For game developers, Unity's docs point to uses such as NPC behavior (including multi-agent and adversarial setups), automated testing of game builds and comparing design choices before release. It needs a separate Python setup next to the Editor and is built around Unity scenes. AIGamer has not tested it.
Limitation: Setup needs a matching Python stack: Python 3.10, PyTorch 2.1.1 to 2.8.0 (2.9 and later break model export), and the PyPI release (1.1.0) lacks some Python-side changes from the 4.x package
FAQ
Is Unity ML-Agents free?
Yes. It is open source under the Apache-2.0 license and free to use. You run training on your own machine.
Can ML-Agents make NPCs?
Yes. Unity's documentation uses training a non-player character as its main example. You define observations, actions and rewards, train a model, then embed it in the scene.
Which Unity and Python versions does ML-Agents need?
The 4.2 package docs say Unity 6000.0 or later, Python 3.10 (3.10.1 to 3.10.12) and PyTorch 2.1.1 to 2.8.0.
What training methods does ML-Agents support?
PPO and SAC reinforcement learning, MA-POCA for cooperative multi-agent training, self-play, curriculum learning, and imitation learning with behavioral cloning and GAIL.
Sources
Compiled by AIGamer from Unity ML-Agents's own pages and the sources below, checked 3 November 2026. We haven't tested Unity ML-Agents hands-on.
- Unity Documentation: ML-Agents package documentation (latest)
- GitHub (Unity Technologies): Unity-Technologies/ml-agents README
- GitHub (Unity Technologies): ml-agents LICENSE.md
- Unity Documentation: ML-Agents package 4.2 overview
- Unity Documentation: Install the ML-Agents Toolkit
- Unity Documentation: ML-Agents Overview
- GitHub (Unity Technologies): ML-Agents releases
Image: Unity Technologies (GitHub)
Written in our own words; quotes are marked and credited. How we report