Event: agent is nullable
databaseFunctions: add docstrings
databaseFunctions: add tests