https://discord.gg/botpress logo
variable inside variable in prompts
# 🤝help
s
Hey there, quick question: Does botpress recognize variables inside variables? Usecase: I use a couple actions in multiple places. Instead of copy and pasting the prompts for these action everytime I defined a variable and saved the custom prompt as default value in it. In these custom prompts I use variables to get some other information. Back to the question: Do you run a recursive loop to really match all variables or just a one time run and my variables are sent as plain text?
w
In the prompt, there is no code interpreter, but the LLM tries to understand actions with variables. Some use
@scope.variableName
, while others use
{{scope.variableName}}
. I use Markdown. The important thing is to have a clear prompt and use the appropriate scope:
workflow.variableName
,
conversation.variableName
, and
user.variableName
.
s
But when I add a variable like that in the prompt Date today: {{bot.today}} it will become: Date today: 19.11.2025 13:15 The question is if I add a prompt like that: Persona: {{bot.persona}} it will become: Persona: You are a chatbot with name "{{bot.name}}" or Persona: You are a chatbot with name "My Chatbot"
l
Maybe these docs links can help provide insight! - https://www.botpress.com/docs/learn/reference/variables/overview - https://www.botpress.com/docs/learn/reference/variables/scopes/bot#read-a-bot-variable - https://www.botpress.com/docs/learn/reference/variables/scopes/user#read-a-user-variable Have a quick read and let me know if it helps @square-restaurant-14664 It's not necessarily a recursive loop, but rather a rendering process that resolves all placeholders in the final text before it's displayed. This allows you to create reusable templates and prompts, just like you're trying to do.