---
title: "Agents & Environments"
description: "A four-cell corridor game: the agent picks moves, the environment applies the rules and returns rewards, and a policy chooses. Trace one episode by hand."
canonical_url: "https://fanout.sh/ai/lessons/reinforcement-learning-agents-environments"
md_url: "https://fanout.sh/ai/lessons/reinforcement-learning-agents-environments.md"
access: "pro-preview"
---

# Agents & Environments

A four-cell corridor game: the agent picks moves, the environment applies the rules and returns rewards, and a policy chooses. Trace one episode by hand.

- Access: Fanout Pro (public preview)
- Module: Reinforcement Learning

## A glimpse of Agents & Environments

Put a player at position 0, the left end of a corridor with positions 0, 1, 2 and 3. It can move left or right. Reaching position 3 ends the game and gives +5 reward. Every other move gives −1.

The agent chooses the move. The environment applies the corridor's rules and returns what happened. A policy is the rule the agent uses to choose actions. “Always move right” is already a policy, even though it has not learned anything.

## Continue learning

Pro unlocks guided learning, complete notes, practical walkthroughs, exercises, and every AI Research lesson.

---
This representation contains public Fanout content only. Protected Pro lessons, account data, billing, checkout, and pricing are not included.

Browse the public content map: https://fanout.sh/sitemap.md
