[Plugin development] How to run a method in the node that's running the build?

I’m developing a jenkins plugin that has a post build action wherein it reads a file in the workspace and does some processing on it. Creating this by extending the Recorder class and overriding it’s perform method.
The issue is, in a controller-agent configuration, the plugin is trying to find the file in the master node even if the build runs on the agent.
Could someone guide me on how can I run a method on the node where the build was run?
I see a launcher argument in the Recorder class - BuildStepCompatibilityLayer (Jenkins core 2.359 API)
Will this be helpful to me?