make agent needs a context.  Also, move more stuff into common