FreeCAD uses Open CASCADE, which is is a free software (LGPL) CAD kernel. Open CASCADE has a comprehensive modeling API which uses B-rep. For scripting, FreeCAD has a Python interface. CadQuery is another Python tool (DSL) which is a plug-in for FreeCAD. FreeCAD itself already has some constraint functionality.
Libfive is layered and can be used without Studio to generate models with its extensible Guile Scheme binding. It uses F-rep modeling.
Correct me if I'm wrong, but it should be possible today to add a programmatic (non-GUI) constraint solver to either FreeCAD or Libfive.