Agents is a part of Langchain.
As RAG has already been explained. Langchain is library in Python that acts as an interface between different language models, vector stores and all kinds of libraries. It makes it easier to build RAG models and other LLM solutions.
Note that it is LLM model agnostic and is not reliant on one single LLM provider, like OpenAI.