In a pentatonic piece (let's say the pitches were Bb, C, Eb, G, and F) can you have a D or an A, just not on a strong beat?
If you do, it by definition won't be a pentatonic scale "compliant" (for lack of a better workd) piece anymore. It would become a piece in the key corresponding to the notes in presence.
If you are in the process of modulating to an other mode, or pentatonic scale, then the note would still be in the five pitches of the next mode.
So, no, in theory you would have to stand to the original notes of the scale.
If this is just for yourself then yes, you can do whatever you think sounds good. If bringing in notes outside the scale you are working with sounds good to you then absolutely do it.
However, if this is for a class assignment, then I would follow the guidelines of the assignment to the letter. When I took music theory in college I got docked points on a composition for using notes/chords outside of what was "acceptable" for the time period we were studying...in this case it didn't matter at all that those outside chords sounded good to me. lol
If it sounds good you can do it. BTW all the notes you listed would be in the scale of Bb Major or G natural minor.