Refined prepare resource support and added prepare InstrumentAgentInstance