Cage-shaped proteins with an affinity for carbonaceous materials were constructed and used to assemble a nanostructure in which single-walled carbon nanotubes are surrounded by cobalt oxide nanoparticles with nanometre gaps. By changing the size of proteins and materials incorporated inside the cavity, similar structures with distinctively different properties can be fabricated.