safe_format
Function
This function is defined in the agents_generator module.Safely format a string template, preserving JSON-like curly braces. This handles cases where templates contain Gutenberg block syntax like {“level”:2} which would cause KeyError with standard .format(). Uses a two-pass approach:
- Escape all {{ and }} (already escaped braces)
- Only substitute known variable placeholders
Signature
Parameters
String template with {variable} placeholders **kwargs: Variable substitutions to apply
Returns
Formatted string with variables substituted and JSON preserved

