To add some context to the above, a request is sent to the AI such as “write a weekly summary for the client Acme Inc for work done this week”
Its task is to go to various tools like Slack, gather all the conversations for the given client (in the client’s Slack channel), and identify everything that was discussed to produce a summary of the work carried out that week.
In order for this to work, we need to provide specific parameters to the Slack tool, in order for the tool to know what data to find and send back.
The current iteration of the AI Agent seems to be able to send hard-coded parameters to tools, but the AI itself is creating those parameters. And I can’t seem to find a way to include those params when requesting data from the tool.
So I copied your workflow and removed the instructions on how to format the JSON from the Custom Tool (" {
“method”: “POST or GET”,
“channelName”: “Channel Name”,
“message”: “Message Content”,
“threadId”: “Optional Thread Identifier for Replies”,
“startDate”: {
“type”: “string”,
“format”: “date-time”,
“description”: “Optional start date and time for filtering messages”
},
“endDate”: {
“type”: “string”,
“format”: “date-time”,
“description”: “Optional end date and time for filtering messages”
}
}"
And no longer got this error. I think this is redundant, as you have the output parser with the same instructions? It’s possible that because of this, the agent was outputting messed up JSON?
Thanks @Mark_Da_Marketer - if I’m not mistaken, the output parser controls how the agent outputs the final data, whereas the instructions I gave the AI control how the AI sends data to the individual tools. In the big picture there will be multiple tools, each with their own data input requirements.
So the two are quite different and both are needed. Unless I’ve misunderstood something?
Honestly, the documentation for the Langchain nodes are so sparse, that I am not quite sure. I do know that when the output instructions were removed from the tool description, the error didn’t occur - so that seems to be where the issue is.
@James_Pardoe As others pointed out, the structure output parser should only be used for the final output. But I would advise you to use a simple chain just for parsing the output since adding the formatting instructions can sometimes confuse the LLM.
Regarding the tools calling — agent can only provide a single dynamic argument to the tool, so you need to ask it to pass a stringified object if you want it to provide more. Here’s an example:
This would correctly pass the arguments to the tool as stringified JSON:
Regarding the ERROR: Single ‘}’ in the template. error you’ve mentioned, that seems to be due to some clashes in the Langchain expression language; I’ll have a closer look at what’s causing it. But in the meantime, you can get around this by escaping the curly brackets using double-curlies, which is what I did in the workflow above.