Get the current agent process for this thread, if any.
Execute a block with this AgentProcess as the current process for the thread. Properly saves and restores any previous value, ensuring cleanup even on exception.