Skip to main content
Dome makes it easy to create and define your own detection methods to use in Guardrails that can execute custom logic to protect your agents. To create a custom Detector, you need to register it to a category with a name. The example below showcases how to make a custom Detector that checks to see if the input string is within a minimum and maximum length.
You can now use custom-length-detector in your Dome configuration.
Make sure you define your custom detection logic before you instantiate your configuration. Alternatively, you can define it in another file and import the class before loading your config. This is to ensure that the register_method decorator can register your Detector before it gets used.
Last modified on July 22, 2026