Refactored engine/agent protocol