I found an interesting project on codeproject. http://www.codeproject.com/KB/database/SQLAgent.aspx
I'm going to examine the code and I might even convert it to C#.