You might need to isolate for 2 weeks or longer while you wait for your medication to work. Your doctor will test your sputum regularly to determine whether you're still contagious. A negative sputum test means you can no longer spread TB and can safely stop isolating.
Still, even if you're no longer contagious, you should continue to take your medications as prescribed. Completing the entire course of treatment is vital.