A kill -9 cannot even be intercepted by the process and it is shut down hard. When the DB2 engine detects that a process like a db2agent is missing, it doesn't know what's going on and it will (usually) shut itself down completely before it starts to corrupt something.
A db2agent is a db2sysc process. When a new agent is spawned, a db2sysc process is started and that process renames itself to db2agent. So when you kill an agent, you kill a db2sysc process. (Note that this may be different on different platforms and DB2 versions.)
Shell scripts cannot suffer from this particular issue - the process model prevents that. In a shell, all DB2 commands are executed through a db2bp (db2 background process). When the db2bp goes away (kill -9 or whatever), the DB2 engine only notices that a client application crashed, rolls back any in-flight transactions and continues on.
p.s: If you have some sort of serious problem, you may want to have a look at the db2_kill command.