Scott Cogan commited on
Commit
e9c2ba5
·
1 Parent(s): 16cd708

fix: Update CustomCodeAgent to use Jinja2 template rendering

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -243,8 +243,8 @@ class CustomCodeAgent(CodeAgent):
243
  def initialize_system_prompt(self):
244
  # Override to use tools_dict for template rendering
245
  template = self.prompt_templates["system_prompt"]
246
- # Use getattr to safely access attributes that might not be set yet
247
- return template.format(
248
  tools=self.tools_dict,
249
  task=getattr(self, 'task', ''),
250
  managed_agents=getattr(self, 'managed_agents', []),
 
243
  def initialize_system_prompt(self):
244
  # Override to use tools_dict for template rendering
245
  template = self.prompt_templates["system_prompt"]
246
+ # Use Jinja2 template rendering
247
+ return Template(template, undefined=StrictUndefined).render(
248
  tools=self.tools_dict,
249
  task=getattr(self, 'task', ''),
250
  managed_agents=getattr(self, 'managed_agents', []),