The basic difference is that if you "agree with something/somenone", it means you share the same opinion as someone or you think something is a good or valid statement/concept/idea. When you "agree to something", it means you accept or approve of it: I agree with you on this subject. = I share your opinion on this subject.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.