There are three problems:
1. Making a nano machine like a B cell, possibly by re-engineering a B cell with genetic therapy. It is a challenge in the realm of synthetic biology.
2. Making a smart detector for viruses, something that is done already in the innate immune system, but obviously it should be better and be equipped with a "stop" system.
3. Producing an antigen/antibody.
A difficulty is that not all humans react in the same manner to antibodies. This is why designing vaccines is so hard. You should look at MHC I and II complexes. There are hundreds or more MHC subtypes and each subtype roughly means a different antigen. There are prediction servers that help to design antigens [0].