"I agree" means that you agree with something that has just been said.
Anna: "We seriously need to be doing more to stop the wildfires."
David: "I agree."
The statement "I agree with" is not a whole sentence. If you use this, you have to say what you agree with, or whom you agree with.
Anna: "We seriously need to do more to stop the wildfires."
David: "I agree with you. It's terrible."
Anna: "That test was too hard."
David: "I totally agree with that."
When agreeing with a statement, we usually use "that."
We also use "I agree" as part of a sentence: "I agree that..."
Anna: That test was too hard."
David: "I agree that it was hard, but I have taken harder tests."
I hope this helps.