Factor out agentFromSession
Merge branch 'master' of https://github.com/leithaus/agentui