Agents are automatically started by the Akonadi server and thus are not debugable from the start on by the usual methods. A similar problem is known from KIO slaves, the solution is similar as well.
Export the environment variable AKONADI_DEBUG_WAIT and put a list of agent types in there you want to debug.
When starting an agent of one of these types, you'll see the following debug output by the Akonadi server which is pretty much self-explanatory.
============================================================ ProcessControl: Suspending process akonadi_knut_resouce 'gdb -pid 1234' to debug 'kill -SIGCONT 1234' to continue ============================================================
Running an agent in valgrind is done in a similar way, you need to export AKONADI_VALGRIND and put the agent type list in there.
Additionally, you can specifiy the valgrind tool to use by exporting AKONADI_VALGRIND_SKIN, the default is memcheck.