The field of biocatalysis has advanced from harnessing natural enzymes to using directed evolution to obtain new biocatalysts with tailor-made functions. Several tools have recently been developed to expand the natural enzymatic repertoire with abiotic reactions. For example, artificial metalloenzymes, which combine the versatile reaction scope of transition metals with the beneficial catalytic features of enzymes, offer an attractive means to engineer new reactions. Three complementary strategies exist: repurposing natural metalloenzymes for abiotic transformations; in silico metalloenzyme (re-)design; and incorporation of abiotic cofactors into proteins. The third strategy offers the opportunity to design a wide variety of artificial metalloenzymes for non-natural reactions. However, many metal cofactors are inhibited by cellular components and therefore require purification of the scaffold protein. This limits the throughput of genetic optimization schemes applied to artificial metalloenzymes and their applicability in vivo to expand natural metabolism. Here we report the compartmentalization and in vivo evolution of an artificial metalloenzyme for olefin metathesis, which represents an archetypal organometallic reaction without equivalent in nature. Building on previous work on an artificial metallohydrolase, we exploit the periplasm of Escherichia coli as a reaction compartment for the 'metathase' because it offers an auspicious environment for artificial metalloenzymes, mainly owing to low concentrations of inhibitors such as glutathione, which has recently been identified as a major inhibitor. This strategy facilitated the assembly of a functional metathase in vivo and its directed evolution with substantially increased throughput compared to conventional approaches that rely on purified protein variants. The evolved metathase compares favourably with commercial catalysts, shows activity for different metathesis substrates and can be further evolved in different directions by adjusting the workflow. Our results represent the systematic implementation and evolution of an artificial metalloenzyme that catalyses an abiotic reaction in vivo, with potential applications in, for example, non-natural metabolism.