[agent] refactor Search