Rapid enzyme immobilization is essential for enzyme catalysis and sensing applications, yet constructing effective immobilization systems is challenging due to the need to balance enzyme activity with the properties of the surrounding framework. Herein, taking glucose oxidase (GOx) as a model, a rapid and straightforward approach was presented for synthesizing palladium nanoparticles (PdNPs)-decorated GOx encapsulated in HOF-101 nanocomposite materials (designated as PdNPs/GOx@HOF-101) through an in situ photoreduction and enzyme-triggering HOF-101 encapsulation. The enzyme's surface residues trigger the nucleation of HOF-101 around it through the hydrogen-bonded bio interface, completing the self-assembly of HOF-101 in 0.5 h. Furthermore, the biocomposites loaded with ultrafine PdNPs show satisfactory photoelectrochemical (PEC) properties. As a proof-of-concept, a PEC biosensor was constructed by utilizing PdNPs/GOx@HOF-101 as a photoactive probe, which can quickly and sensitively detect glucose and simultaneously remain stable within the circumstance of 30-60 °C and pH 4-8. These attributes pave the way for diverse applications, including improved enzyme immobilization techniques, advanced biosensors, and more efficient biocatalytic processes.