Agents are advanced semi-autonomous programs. They can act on their own, within their programming. But that's not really what they're good with (unless they get the Fuzzy Logic upgrade). Though an Agent is basically an IC program, and it can hack something, it's not good at doing anything afterwards, or during the hack. So, if a Spider comes around, the agent will probably abort and alert it's owner that his task was too risky to carry on (security and self-preservation protocols).
For example:
Katrina is a Rank 3 Agent program, and Griffin owns a small program suite including Analyze 4, Browse 4, Command 2, Edit 4, and PocketMage Library 3. The Agent can use all of those programs, if it's currently running on the commlink(and Griffin allows the agent access to it), but since it's Rating is only 3, it caps the dice provided by Analyze, Browse and Edit at 3, even if these programs have higher ratings.
You can find a detailed description of what Agents are, and what they can do in SR4A on page 234. Especially the sidebar is really helpful...