# How does a model based agent learn the model?

I want to build model-based RL. I am wondering about the process of building the model.

If I already have data, from real experience:

• $$S_1, a \rightarrow R,S_2$$
• $$S_2, a \rightarrow R,S_3$$

Can I use this information, to build model-based RL? Or it is necessary that the agent directly interact with the environment (I mean the same above-mentioned data should be provided by the agent)?