RestrictedPython
RestrictedPython is a Python library that compiles untrusted code into a restricted subset of the language, limiting access to builtins, attributes and imports so a host application can run it with reduced risk. LiteLLM adopted it in 2026 to replace a hand-built guardrail sandbox.