Setting Limits for Memory Usage and Byte Limits in Jupyter Server Kernels via API

I am using Jupyter Server to run code and would like to limit the memory usage, input bytes, and output bytes for each kernel via API. Could you suggest a good solution for this? Thank you.