1. A non-transitory computer readable storage medium storing one or more sequences of instructions, which when executed by one or more processors, causes: in response to receiving a request to perform an action, instantiating an isolated environment without receiving an explicit user instruction to instantiate said isolated environment by performing: identifying one or more templates from multiple pre-existing templates for use in instantiating said isolated environment based on a policy, wherein each of the multiple pre-existing templates describes isolated environment characteristics configured for different types of activity, wherein said policy additionally considers the provenance of executable code associated with said action in one or more of (a) identifying said one or more templates for use in instantiating said isolated environment or (b) determining whether to instantiate said isolated environment; and after instantiating said isolated environment using said one or more templates, performing said action in said isolated environment.