Dynamic Variable Integration via custom tools
# general-english
j
Hi friends! Any guidance is greatly appreciated. I designed a Supabase Edge Function that provides the following variables when called: { "current_date": "2025-06-14", "current_time": "5:52 PM", "day_of_week": "Saturday", "is_club_open": "closed", "todays_hours": "10 PM - 3 AM", "chicago_timezone": "Central Time", "next_open": "tonight", "formatted_date": "Saturday, Saturday" }
^ That is the response body when I test the tool btw
But my issue is referencing this information via the prompt my agent has. Every time I ask what the time is, I am met with an error where the agent replies that it has trouble getting the relevant information. Any advice on how I can adjust my prompt so it stores these variables and references them when asked something like "what time is it?"?
s
You have to instruct the agent to use the information it has from connected tools when asked something. Your agent can figure out from context when someone is asking it the time , but if you need it to grab a particular answer of hem your prompt conversation flow has to bespecific about what took to use and what information from the tool to use to answer the query . You can either explicitly call the tool or tell your agent that use tool foo and get variable bar when asked anything about the current time. If it's real time information then I'd explicitly call the tool via the
->
format and tell the agent to use the information it's just received from the took call. Treat yht agent like a 5 year old, it needs explicit instructions when you absolutely want it to do something predictable and stable
j
Thank you for the response!
Turns out I was being very stupid this whole time and didn't realize that the default variables mentioned in the dynamic variable documentation meant that they can be called without external references
Replaced my tool and function with {{now}}
s
Ah yeah that's a thing. You mentioned supabase so I assumed you needed something that was not just {{now}}.
2 Views