# Policies

### [Configuring Policies](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#configuring-policies)

The `rasa.core.policies.Policy` class decides which action to take at every step in the conversation.

There are different policies to choose from, and you can include multiple policies in a single [`rasa.core.agent.Agent`](https://legacy-docs-v1.rasa.com/1.8.0/api/agent/#rasa.core.agent.Agent).

Note

Per default a maximum of 10 next actions can be predicted by the agent after every user message. To update this value you can set the environment variable `MAX_NUMBER_OF_PREDICTIONS` to the desired number of maximum predictions.

Your project’s `config.yml` file takes a `policies` key which you can use to customize the policies your assistant uses. In the example below, the last two lines show how to use a custom policy class and pass arguments to it.

```
policies:
  - name: "KerasPolicy"
    featurizer:
    - name: MaxHistoryTrackerFeaturizer
      max_history: 5
      state_featurizer:
        - name: BinarySingleStateFeaturizer
  - name: "MemoizationPolicy"
    max_history: 5
  - name: "FallbackPolicy"
    nlu_threshold: 0.4
    core_threshold: 0.3
    fallback_action_name: "my_fallback_action"
  - name: "path.to.your.policy.class"
    arg1: "..."
```

### [Max History](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#max-history)

One important hyperparameter for Rasa Core policies is the `max_history`.

You can set the `max_history` by passing it to your policy’s `Featurizer` in the policy configuration yaml file.

### [Data Augmentation](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#data-augmentation)

When you train a model, by default Rasa Core will create longer stories by randomly gluing together the ones in your stories files.

### [Action Selection](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#action-selection)

At every turn, each policy defined in your configuration will predict a next action with a certain confidence level.

### [Keras Policy](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#id11)

The `KerasPolicy` uses a neural network implemented in [Keras](http://keras.io/) to select the next action.

```python
def model_architecture(
    self, input_shape: Tuple[int, int], output_shape: Tuple[int, Optional[int]]
) -> tf.keras.models.Sequential:
    # Implementation details...
    pass
```

### [Mapping Policy](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#id14)

The `MappingPolicy` can be used to directly map intents to actions.

### [Memoization Policy](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#id15)

The `MemoizationPolicy` just memorizes the conversations in your training data.

### [Augmented Memoization Policy](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#id16)

The `AugmentedMemoizationPolicy` remembers examples from training stories for up to `max_history` turns.

### [Fallback Policy](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#id17)

The `FallbackPolicy` invokes a fallback action if certain conditions are met.

**Configuration:**

```
policies:
  - name: "FallbackPolicy"
    nlu_threshold: 0.3
    ambiguity_threshold: 0.1
    core_threshold: 0.3
    fallback_action_name: 'action_default_fallback'
```

### [Two-Stage Fallback Policy](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#id18)

The `TwoStageFallbackPolicy` handles low NLU confidence in multiple stages.

### [Form Policy](https://legacy-docs-v1.rasa.com/1.8.0/core/policies/#id19)

The `FormPolicy` is an extension of the `MemoizationPolicy` which handles the filling of forms.
