thanme, i am going to disagree with noelDP.. i don't think you need to reformat your harddrive just because the update for "windows update agent" isn't installing..
you asked what causes the error.. i believe that the problem is because the "windows updater" is detecting a problem with the "hash" for one-or-more files within the "softwaredistribution" folder, which is used by the windows updater..
when the update failed to install, it generated an "error code: 80070002", which you mentioned in your first post.. if you had done a google-search for "error code 80070002", it would have taken you to this webpage:
Windows Update error 80070002 - Windows Help
follow the instructions on the webpage, posted above, deleting the files that the instructions say to delete, within folders that are within the "softwaredistribution" folder.. be careful to only delete the files that the instructions say to delete..
essentially, the instructions say:
1. temporarily "stop" the "windows update service", in "services"
2. delete all of the content within the "datastore" folder, at "c:\windows\softwaredistribution\datastore".. (don't delete the folder itself)..
3. delete all of the content within the "download" folder, at "c:\windows\softwaredistribution\download".. (don't delete the folder itself)..
4. re-"start" the "windows update service", in "services"..
see if that resolves the problem..
if the problem isn't resolved, try running the "system update readiness tool", which is mentioned on the same webpage, posted above.. here is a link for the webpage for the "system update readiness tool":
What is the System Update Readiness Tool? - Windows Help
here is a link to a webpage with some information about troubleshooting problems with installing updates:
Unable to install updates in Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2