Hello Retool community.
I've been trying to customize my own agent for the demo app I'm working on.
I added an Agent Chat and configured this message:
{
"messages": [
{
"role": "user",
"content": The question you have been asked is {{ agentChat3.agentInputs }}.The patient you need to evaluate is {{ idSelectedPatient_Analytics.value }}. Read that data, evaluate it, and answer
}
],
"action": "invoke"
}
Instead of returning an answer, it started printing over and over "thinking". I thought it was something I missed in the configuration, but it was actually queueing the same petition, until I ran out of free tokens.
Is there something I can do now / something I missed?
Agent chat component configuration:
Agent instructions and tools
Tool configuration to read the data from the database
Tool function logic
Logs displaying the right output, but all of them triggered every 5~ seconds
This consummed all my credits, and I didn't get an output in the Agent Chat, only the "thinking" message as I said before.
Thanks a lot
For what is worth, I believe that the reason for this is the following:
- The agent chat component is linked to a query, in this case your agentChat4_query1
- As designed, if you use agentChat4_query1.agentInputs, it would contain the message, and the
invoke
property, like:
-
once it triggers, it will start polling, and the chart action property will change to getLogs
:
-
It will keep doing it until it gets the results for that agentRunId
-
What is happening with what you're doing, is that the query's data is not changing to getLogs
. It is actually triggering the query every time because it is trying to poll, but actually is triggering invoke
each time
Not sure if there is a way of capturing the promise in a transformer and link that to the action
property in your message setting, so that you can dynamically set whether it is invoke
or getLogs
Hope that makes sense
1 Like
Hey @MiguelOrtiz, thanks for your answer.
Maybe there is an easier way to do it?
What I wanted was to ask the AI Agent for the patient I was inspecting (saved in the global variable idSelectedPatient_Analytics) and get the results, but it always made me type the patientID, because it couldn't read the global variable that contains it.
That's why I wrote both the agentChat3.agentInputs and the idSelectedPatient_Analytics in the message.
Hey @ArturoGonzalez,
As of now, there isn't an easy way, the only work around I can think of, similarly to what was done here is to update a table in your database (rather than setting a global variable) and then add a tool to the agent that fetches the id from that table, and instruct the agent accordingly.
It's not great, but you can get it to work.
Thanks a lot @MiguelOrtiz !
I logged in just to ask if that was a possibility haha.
Sadly, there is no way to test this until next month due to the query getting stuck in the invoke state, so I'll need to wait a few days in order to confirm this and share my workaround too.
1 Like