Skip to content
beginner

Policies in Reinforcement Learning: From Rules to Decisions Under Uncertainty

A policy is not a rulebook. It is a decision rule that keeps producing choices as the agent moves through the world—and every choice reshapes which futures…

Published 2026-09-09Updated 2026-09-1210 min read
Three children in costumes playing chess on a stone outdoors in a forest.
Three children in costumes playing chess on a stone outdoors in a forest. Photo by Kampus Production on Pexels.

A policy is not a rulebook. It is a decision rule that keeps producing choices as the agent moves through the world—and every choice reshapes which futures are possible.

Why a Policy Is Not a Fixed List of Actions

When most people first hear about policies in reinforcement learning, they picture an instruction manual: if you see this situation, do this action. A lookup table. A rulebook that tells the agent exactly what to do everywhere.

That mental model works in a small, fully predictable world. Think of a chess puzzle where the board is fully visible and every position has one clear best move. A fixed list works because nothing surprises you.

But reinforcement learning rarely happens in worlds like that. The agent usually has incomplete information—sensors with noise, hidden state, outcomes that involve chance. And even when the situation looks the same, the best action can depend on things the agent cannot directly see.

So what is a policy in reinforcement learning, really?

A policy is the agent's decision rule: a function that takes what the agent observes and returns what it should do. Not a list of pre-written answers, but a live rule that keeps producing actions as the agent moves through the world.

The distinction matters because the agent does not act on perfect knowledge of the true state. It acts on observations. And observations can be partial, noisy, or ambiguous. The policy bridges that gap—turning imperfect information into a concrete choice.

One convention will keep this clear: in the general case, think of the policy's input as an observation. In a fully observable environment, that observation may equal the true state. When the agent sees everything, the two are the same thing. When it does not, the policy still has to decide from what it actually gets.

Knowledge check

Check your understanding

Answer this question before you continue.

Which description best matches a policy in reinforcement learning?
Misconception Check

Focus: Distinguish a policy as an observation-to-action decision rule from a fixed list of pre-written actions.

Deterministic Policies: One Situation, One Action

A deterministic policy is the simplest kind of decision rule: given the same observation, the agent always picks the same action.

Imagine a thermostat. When the room temperature drops below the target, it turns the heat on. When the temperature rises above the target, it turns the heat off. Same situation, same action, every time. That is a deterministic policy in action.

Or picture a robot in a simple gridworld. The robot can move up, down, left, or right. A deterministic policy might say: when you're in the top-left cell, always move right. Every time the robot finds itself in that cell, it moves right. No exceptions.

Deterministic policies are attractive because they are predictable. You can inspect the rule and know exactly what the agent will do. Once the agent has learned a genuinely good strategy, that consistency is often exactly what you want.

But a deterministic policy has a blind spot: it cannot hedge. If the agent is genuinely unsure which action is best, a deterministic policy still commits to one choice. And it never explores on its own. It will keep picking the same action forever, even if that action is suboptimal, because it has no mechanism for trying anything different.

Knowledge check

Check your understanding

Answer this question before you continue.

A robot follows a deterministic policy. What should happen when it encounters the same observation again?
Single Choice

Focus: Identify the defining behavior of a deterministic policy.

Stochastic Policies: Choosing Actions With Probability

A stochastic policy does something a deterministic policy cannot: it assigns a probability to each possible action instead of committing to just one.

Picture a game agent standing at a fork in a maze. A stochastic policy might say: move left 70% of the time, move up 30% of the time. The agent samples from those probabilities each time it makes a decision. Sometimes it goes left. Sometimes it goes up. Over many decisions, the proportions settle into the policy's probabilities.

This randomness is not a bug. It is the agent's way of learning.

Early in training, the agent has no idea which actions lead to rewards. It needs to gather evidence. By sampling different actions, it discovers what works and what does not. A stochastic policy is how the agent says: I'm not sure yet, so I'll try a mix of options and see what pays off.

This connects directly to the exploration-exploitation tension that runs through all of reinforcement learning. Exploitation means using what you already know works. Exploration means trying things you are not sure about. A stochastic policy lets the agent do both—mostly choosing actions it believes are good, but occasionally sampling alternatives that might be better.

One confusion beginners often hit: a policy's probabilities are not the same as a value estimate. The policy says what to do—which actions get how much probability. A value function says how good a situation or action is. They are related, but they answer different questions. The policy is the decision rule; the value function is the agent's judgment about quality. Many algorithms learn one from the other, but they are distinct concepts.

Knowledge check

Check your understanding

Answer this question before you continue.

A policy assigns 70% probability to moving left and 30% to moving up. What does this information directly describe?
Comparison Reasoning

Focus: Distinguish action probabilities supplied by a policy from quality judgments supplied by a value function.

How a Policy Shapes a Trajectory

A loop shows an observation entering a policy decision, which produces an action sent to the environment; the environment returns a new observation and the cycle repeats. The policy decision branches into two possible actions to illustrate stochastic behavior and different trajectories.
A policy repeatedly turns observations into actions; policy randomness or environmental uncertainty can send the agent along different trajectories.

Here is where the policy stops being an abstract idea and becomes something you can watch move.

A trajectory is the sequence of observations and actions an agent produces as it acts. The agent observes its situation, the policy picks an action, the environment responds with a new situation, the policy picks again, and so on. Each step in that chain is shaped by the policy.

Let us walk through a short episode. A robot starts in a room. It observes its position. The policy says move forward. The robot moves forward and arrives at a new position. The policy says turn left. The robot turns left. The sequence of positions and actions—from the starting point to the final point—is the trajectory.

Now here is the key insight: the policy determines which actions appear in the trajectory, but it does not fully determine the trajectory itself.

If the environment is stochastic—say, the robot's wheels slip 10% of the time—the same policy can produce different trajectories on different runs. The robot intends to move forward, but sometimes it ends up slightly to the left.

And a stochastic policy can produce different trajectories even in a completely deterministic environment. The policy says move left 70% of the time, up 30% of the time. The environment always responds the same way to each action. But because the policy itself is random, the agent's path through the world varies from run to run.

Picture a branching tree. At each decision point, the stochastic policy fans out into multiple possible futures. One branch goes left, another goes up. Each branch leads to a different next situation, and each next situation opens new branches. The set of all possible trajectories is the tree the policy creates.

This gives you a powerful mental experiment. Take any policy and change one probability—say, shift the robot from 70/30 to 50/50. What happens to the tree? The branches that were less likely become more likely. The set of possible futures shifts. Some trajectories that were rare become common; some that were common become rare.

That is what it means for a policy to shape behavior. It does not just pick actions. It determines which futures are likely and which are unlikely.

Knowledge check

Check your understanding

Answer this question before you continue.

A robot uses the same stochastic policy in a deterministic environment on two runs. Why can the runs still produce different trajectories?
Scenario Interpretation

Focus: Predict how policy randomness and environmental randomness affect possible trajectories.

Choosing Between Deterministic and Stochastic Behavior

So which should you use? The answer depends on the behavior you actually want, not on a simple training-versus-deployment rule.

Use deterministic action selection when you want consistency: the same observation should always produce the same choice. This makes sense when one action is clearly best and repeating it reliably matters.

Use stochastic sampling when diversity or uncertainty-aware behavior is part of the task. Sometimes multiple actions remain genuinely useful, and the agent should keep trying them. Sometimes the environment is unpredictable enough that committing to a single action is premature. In those cases, randomness is not a sign of confusion—it is the intended decision rule.

There is an important distinction to keep straight here. During training, many algorithms add exploration noise: temporary randomness that encourages the agent to try new actions while it is still learning. That noise is often reduced or removed later. But a stochastic policy can also represent the agent's final learned strategy, with probabilities that reflect genuine uncertainty or deliberate randomization.

This is why many reinforcement learning libraries let you switch between sampling from a stochastic policy and selecting its most likely action when evaluating. The choice is not about which mode is more "correct." It is about which behavior you want to measure. If you want to know how the agent performs when it acts consistently, select the highest-probability action. If you want to know how it performs when it follows its full learned distribution, sample from it.

One warning: do not mistake a stochastic policy for a confused agent. Randomness during training is deliberate. The agent is not broken—it is exploring. And randomness in a learned policy can be just as deliberate. The question is always the same: what behavior does this task actually reward?

Where This Mental Model Helps and Where It Stops

The durable takeaway is this: a policy is the agent's decision rule, and the choice between deterministic and stochastic behavior is really a choice about which futures you want the agent to produce.

This mental model will carry you far. When you read about reinforcement learning algorithms, you will see them described in terms of the policies they produce. Some algorithms learn value functions and derive policies from them. Others learn policies directly. But in both cases, the policy is the thing that actually makes decisions.

Where does the model start to stretch? When policies become large neural networks. A deep neural network policy is still a decision rule—it still maps observations to actions—but it is no longer something you can inspect line by line. You cannot read it like a lookup table. You can only observe its behavior. The decision-rule model still holds; it just becomes less transparent.

Also remember that policies are not just written—they are learned. The agent starts with some initial policy, interacts with the environment, receives rewards, and gradually improves its decisions. That learning process is driven by the reward signal, which is a topic of its own.

A Mental Experiment to Make It Stick

Here is a concrete exercise you can run right now. Take a small environment you already understand—a grid, a board game, a robot in a room. Write a deterministic policy for it. Spell out exactly what action the agent takes in each situation.

Now add a little randomness. Change one rule so that 20% of the time, the agent picks a different action instead.

Predict what happens. Which trajectories that were impossible before are now possible? Which trajectories that were guaranteed are now merely likely? How does the set of possible futures change?

Run the experiment in your head, or in code if you have an environment handy. Watch what changes. That habit—predicting how a policy change reshapes the set of possible trajectories—is the skill that will carry you through everything else in reinforcement learning.

Knowledge check

Final check

Finish the article by checking the ideas you just learned.

During evaluation, which approach measures performance when an agent follows its full learned action distribution?
Question 1 of 2Comparison Reasoning

Focus: Choose between most-likely action selection and stochastic sampling based on the behavior being measured.

A policy changes from choosing left 70% of the time and up 30% of the time to choosing each 50% of the time. What is the direct consequence?
Question 2 of 2Scenario Interpretation

Focus: Predict how changing a policy's action probabilities changes the likelihood of trajectories and futures.

References

  1. Part 1: Key Concepts in RL — Spinning Up documentationspinningup.openai.com
  2. Policy Gradient Methods for Reinforcement Learning with Function Approximationpapers.nips.cc
  3. Reinforcement Learning Tips and Tricks - Stable Baselines3stable-baselines3.readthedocs.io
8sources checked
8source domains
6searches run

Research updated Sep 9, 2026

Related sites

Continue across related AI foundations

Use LearnPyFast for Python foundations and LearnLLMFast for practical language-model and agent application concepts.

Python tutorialstutorial

LearnPyFast

Beginner-friendly Python tutorials, examples, and learning paths for practical programming foundations.

PythonProgrammingBeginners
Visit LearnPyFast
LLM tutorialstutorial

LearnLLMFast

Practical LLM tutorials for builders who want to understand prompting, workflows, agents, and AI applications.

LLMAIBuilders
Visit LearnLLMFast

Keep learning

Related reinforcement learning tutorials

Continue with nearby RL concepts, algorithms, and experiments that build on the same decision process.