move old into.lua code to lib/agent.lua