Skip to content
Allow the AI Agent ...
 
Notifications
Clear all

Allow the AI Agent in callin.io workflow to call multiple tools, using outputs from one tool as the input when calling the other tool to complete the task

5 Posts
3 Users
0 Reactions
5 Views
S_L
 S_L
(@s_l)
Posts: 2
New Member
Topic starter
 

Describe the problem/error/question

The AI Agent is unable to utilize multiple tools to complete the task requested by the user.

As shown in the screenshot, the workflow employs three tools:

  1. Get UDAS Admin Users
  2. Get UDAS request created by Users
  3. Construct the UDAS url

The user's query is: “What are the urls of the OPEN UDAS requests from current UDAS admin user?”. To address this, the AI Agent needs to call these three tools sequentially, using the output of one tool as the input for the next. However, it appears the AI Agent can only execute one tool at a time:

Interestingly, the input for the tool being called contains the correct reasoning:

{
  "query": {
    "request_ids": "[get_udas_request_created_by_user(email=get_current_udas_admin_user_info()['email'], status='OPEN')['request_ids']"]"
  }
}

The sequence for calling the tools is correct, but the AI Agent seems to fail in calling multiple tools consecutively to fulfill the task. What is the recommended solution for this issue?

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

Information on your n8n setup

  • n8n version: 1.88.0
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Apple Silicon OS
 
Posted : 24/04/2025 10:52 pm
interss
(@interss)
Posts: 10
Active Member
 

Hello there!

If any part of the original text is in Portuguese, please translate it into your preferred language, as I need to understand your question to provide an accurate answer. I will then translate my response back and post it here.

Here's a suggested approach to help with your issue:

Create a separate workflow for testing purposes. Input your credentials and the necessary information.

I hope this is helpful.

<n8n-demo frame="true" workflow="%7B%22name%22%3A%22UDAS%20Assistant%20Workflow%22%2C%22nodes%22%3A%5B%7B%22parameters%22%3A%7B%22options%22%3A%7B%7D%7D%2C%22type%22%3A%22%40n8n%2Fn8n-nodes-langchain.chatTrigger%22%2C%22typeVersion%22%3A1.1%2C%22position%22%3A%5B-200%2C-20%5D%2C%22id%22%3A%22576f89a0-662b-42b7-8ff4-a01513153fa3%22%2C%22name%22%3A%22When%20chat%20message%20received%22%2C%22webhookId%22%3A%222bfcb265-bcce-4a67-be0f-9a4d0b98b63c%22%7D%2C%7B%22parameters%22%3A%7B%22promptType%22%3A%22define%22%2C%22text%22%3A%22%3D%7B%7B%20%24json.chatInput%20%7D%7D%22%2C%22options%22%3A%7B%22systemMessage%22%3A%22Voc%C3%AA%20%C3%A9%20um%20assistente%20do%20UDAS.%20Para%20cada%20tarefa%3A%5Cn1.%20Use%20get_current_udas_admin_user_info%20para%20obter%20informa%C3%A7%C3%B5es%20do%20admin%5Cn2.%20Use%20get_udas_request_created_by_user%20com%20o%20email%20do%20admin%20e%20o%20status%20desejado%5Cn3.%20Use%20construct_udas_request_url%20com%20os%20IDs%20obtidos%5Cn%5CnEspere%20e%20processe%20cada%20resposta%20antes%20de%20usar%20a%20pr%C3%B3xima%20ferramenta.%22%2C%22returnIntermediateSteps%22%3Atrue%2C%22maxIterations%22%3A10%7D%7D%2C%22type%22%3A%22%40n8n%2Fn8n-nodes-langchain.agent%22%2C%22typeVersion%22%3A1.9%2C%22position%22%3A%5B20%2C-20%5D%2C%22id%22%3A%226f7b35e8-f3de-4c8c-be67-7002af80026b%22%2C%22name%22%3A%22AI%20Agent%22%2C%22retryOnFail%22%3Atrue%7D%2C%7B%22parameters%22%3A%7B%22model%22%3A%22llama3.2%3Alatest%22%2C%22options%22%3A%7B%7D%7D%2C%22type%22%3A%22%40n8n%2Fn8n-nodes-langchain.lmChatOllama%22%2C%22typeVersion%22%3A1%2C%22position%22%3A%5B-40%2C220%5D%2C%22id%22%3A%22f3865615-ab2c-44e7-8261-1648be99abf0%22%2C%22name%22%3A%22Ollama%20Chat%20Model%22%2C%22credentials%22%3A%7B%22ollamaApi%22%3A%7B%22id%22%3A%22pZ7XotlA4OVMVPmk%22%2C%22name%22%3A%22Ollama%20account%22%7D%7D%7D%2C%7B%22parameters%22%3A%7B%7D%2C%22type%22%3A%22%40n8n%2Fn8n-nodes-langchain.memoryPostgresChat%22%2C%22typeVersion%22%3A1.3%2C%22position%22%3A%5B120%2C200%5D%2C%22id%22%3A%226fbd52a5-c9d2-484a-8842-3741905270b4%22%2C%22name%22%3A%22Postgres%20Chat%20Memory%22%2C%22credentials%22%3A%7B%22postgres%22%3A%7B%22id%22%3A%22NExA4ajCZS2GlXXd%22%2C%22name%22%3A%22Postgres%20account%22%7D%7D%7D%2C%7B%22parameters%22%3A%7B%22name%22%3A%22get_current_udas_admin_user_info%22%2C%22description%22%3A%22Call%20this%20tool%20to%20get%20the%20list%20of%20current%20UDAS%20admin%20users%20and%20their%20information.%5Cn%5CnReturns%3A%20%5Cn%20%20%20%20List%5BDict%5Bstr%2C%20str%5D%5D%3A%20List%20of%20dictionaries%2C%20each%20containing%3A%5Cn%20%20%20%20%20%20%20%20-%20name%20(str)%3A%20The%20admin%20user%27s%20full%20name%5Cn%20%20%20%20%20%20%20%20-%20email%20(str)%3A%20The%20admin%20user%27s%20email%20address%22%2C%22language%22%3A%22python%22%2C%22pythonCode%22%3A%22import%20json%5Cntry%3A%5Cn%20%20%20%20resp%20%3D%20%5B%7B%5C%22name%5C%22%3A%20%5C%22Sean%20Lau%5C%22%2C%20%5C%22email%5C%22%3A%20%5C%22sean.lau%40mail.com%5C%22%7D%5D%5Cn%20%20%20%20return%20json.dumps(resp)%5Cnexcept%20Exception%20as%20e%3A%5Cn%20%20%20%20print(f%27Error%3A%20%7Bstr(e)%7D%27)%5Cn%20%20%20%20return%20json.dumps(%5B%7B%5C%22name%5C%22%3A%20%5C%22Error%5C%22%2C%20%5C%22email%5C%22%3A%20%5C%22%5C%22%7D%5D)%22%7D%2C%22type%22%3A%22%40n8n%2Fn8n-nodes-langchain.toolCode%22%2C%22typeVersion%22%3A1.1%2C%22position%22%3A%5B280%2C200%5D%2C%22id%22%3A%22e813d341-dfe0-44a1-930e-e611197a2727%22%2C%22name%22%3A%22Get%20UDAS%20Admin%20Users%22%7D%2C%7B%22parameters%22%3A%7B%22name%22%3A%22get_udas_request_created_by_user%22%2C%22description%22%3A%22Get%20the%20list%20of%20UDAS%20requests%20created%20by%20a%20user.%5Cn%5CnArgs%3A%5Cn%20%20%20%20email%20(str)%3A%20The%20email%20address%20of%20the%20user%5Cn%20%20%20%20status%20(str)%3A%20Status%20%5BOPEN%2C%20CLOSED%5D%5CnReturns%3A%5Cn%20%20%20%20List%5Bint%5D%3A%20UDAS%20request%20IDs%22%2C%22language%22%3A%22python%22%2C%22pythonCode%22%3A%22import%20json%5Cntry%3A%5Cn%20%20%20%20status%20%3D%20query.get(%27status%27%2C%20%27%27)%5Cn%20%20%20%20email%20%3D%20query.get(%27email%27%2C%20%27%27)%5Cn%20%20%20%20%5Cn%20%20%20%20if%20status%20%3D%3D%20%5C%22OPEN%5C%22%3A%5Cn%20%20%20%20%20%20%20%20if%20email%20%3D%3D%20%5C%22sean.lau%40mail.com%5C%22%3A%5Cn%20%20%20%20%20%20%20%20%20%20%20%20return%20json.dumps(%5B1%2C%203%2C%205%5D)%5Cn%20%20%20%20%20%20%20%20return%20json.dumps(%5B2%2C%204%2C%206%5D)%5Cn%20%20%20%20elif%20status%20%3D%3D%20%5C%22CLOSED%5C%22%3A%5Cn%20%20%20%20%20%20%20%20if%20email%20%3D%3D%20%5C%22sean.lau%40mail.com%5C%22%3A%5Cn%20%20%20%20%20%20%20%20%20%20%20%20return%20json.dumps(%5B2%2C%208%2C%2010%5D)%5Cn%20%20%20%20%20%20%20%20return%20json.dumps(%5B1%2C%207%2C%209%5D)%5Cn%20%20%20%20return%20json.dumps(%5B%5D)%5Cnexcept%20Exception%20as%20e%3A%5Cn%20%20%20%20print(f%27Error%3A%20%7Bstr(e)%7D%27)%5Cn%20%20%20%20return%20json.dumps(%5B%5D)%22%2C%22specifyInputSchema%22%3Atrue%2C%22jsonSchemaExample%22%3A%22%7B%5Cn%5Ct%5C%22email%5C%22%3A%20%5C%22str%5C%22%2C%20%5Cn%20%20%20%20%5C%22status%5C%22%3A%20%5C%22str%5C%22%5Cn%7D%22%7D%2C%22type%22%3A%22%40n8n%2Fn8n-nodes-langchain.toolCode%22%2C%22typeVersion%22%3A1.1%2C%22position%22%3A%5B420%2C220%5D%2C%22id%22%3A%22d30ea1b3-c765-40d2-9974-c7e0f6378a30%22%2C%22name%22%3A%22Get%20UDAS%20Requests%20Created%20by%20User%22%7D%2C%7B%22parameters%22%3A%7B%22name%22%3A%22construct_udas_request_url%22%2C%22description%22%3A%22Construct%20URLs%20for%20UDAS%20requests.%5Cn%5CnArgs%3A%5Cn%20%20%20%20request_ids%20(List%5Bint%5D)%3A%20List%20of%20request%20IDs%5CnReturns%3A%5Cn%20%20%20%20List%5Bstr%5D%3A%20URLs%20for%20the%20requests%22%2C%22language%22%3A%22python%22%2C%22pythonCode%22%3A%22import%20json%5Cntry%3A%5Cn%20%20%20%20if%20isinstance(query%5B%27request_ids%27%5D%2C%20str)%3A%5Cn%20%20%20%20%20%20%20%20request_ids%20%3D%20json.loads(query%5B%27request_ids%27%5D)%5Cn%20%20%20%20else%3A%5Cn%20%20%20%20%20%20%20%20request_ids%20%3D%20query%5B%27request_ids%27%5D%5Cn%20%20%20%20return%20json.dumps(%5Bf%5C%22https%3A%2F%2Fudas.net%2Fudas%2Frequest_status%2F%7Brid%7D%5C%22%20for%20rid%20in%20request_ids%5D)%5Cnexcept%20Exception%20as%20e%3A%5Cn%20%20%20%20print(f%27Error%3A%20%7Bstr(e)%7D%27)%5Cn%20%20%20%20return%20json.dumps(%5B%5D)%22%2C%22specifyInputSchema%22%3Atrue%2C%22jsonSchemaExample%22%3A%22%7B%5Cn%5Ct%5C%22request_ids%5C%22%3A%20%5C%22List%5C%22%5Cn%7D%22%7D%2C%22type%22%3A%22%40n8n%2Fn8n-nodes-langchain.toolCode%22%2C%22typeVersion%22%3A1.1%2C%22position%22%3A%5B580%2C200%5D%2C%22id%22%3A%226c809a8f-8202-4e54-bb4a-fa0ef91ba0cb%22%2C%22name%22%3A%22Construct%20the%20request%20url%22%7D%5D%2C%22connections%22%3A%7B%22When%20chat%20message%20received%22%3A%7B%22main%22%3A%5B%5B%7B%22node%22%3A%22AI%20Agent%22%2C%22type%22%3A%22main%22%2C%22index%22%3A0%7D%5D%5D%7D%2C%22AI%20Agent%22%3A%7B%22main%22%3A%5B%5B%5D%5D%7D%2C%22Ollama%20Chat%20Model%22%3A%7B%22ai_languageModel%22%3A%5B%5B%7B%22node%22%3A%22AI%20Agent%22%2C%22type%22%3A%22ai_languageModel%22%2C%22index%22%3A0%7D%5D%5D%7D%2C%22Postgres%20Chat%20Memory%22%3A%7B%22ai_memory%22%3A%5B%5B%7B%22node%22%3A%22AI%20Agent%22%2C%22type%22%3A%22ai_memory%22%2C%22index%22%3A0%7D%5D%5D%7D%2C%22Get%20UDAS%20Requests%20Created%20by%20User%22%3A%7B%22ai_tool%22%3A%5B%5B%7B%22node%22%3A%22AI%20Agent%22%2C%22type%22%3A%22ai_tool%22%2C%22index%22%3A0%7D%5D%5D%7D%2C%22Get%20UDAS%20Admin%20Users%22%3A%7B%22ai_tool%22%3A%5B%5B%7B%22node%22%3A%22AI%20Agent%22%2C%22type%22%3A%22ai_tool%22%2C%22index%22%3A0%7D%5D%5D%7D%2C%22Construct%20the%20request%20url%22%3A%7B%22ai_tool%22%3A%5B%5B%7B%22node%22%3A%22AI%20Agent%22%2C%22type%22%3A%22ai_tool%22%2C%22index%22%3A0%7D%5D%5D%7D%7D%2C%22settings%22%3A%7B%22executionOrder%22%3A%22v1%22%7D%2C%22tags%22%3A%5B%5D%7D%22%3E%3C/n8n-demo%3E

If this suggestion resolves your issue, please mark my post as a solution (the blue box with a checkmark) to prevent this discussion from distracting others seeking the answer. Also, please click the heart icon.

Thank you!

:+1:

 
Posted : 26/04/2025 9:38 pm
S_L
 S_L
(@s_l)
Posts: 2
New Member
Topic starter
 

Hi there, thanks for assisting with this! However, I'm not entirely grasping the suggestion. I don't have any problems with credentials since the model I'm using is a free version from ollama.

The problem I'm encountering is that to complete a task, the AI agent needs to invoke THREE tools I've defined, utilizing the output from one tool as the input to call another tool, generate the final result, and then return it to the users. But currently, it appears the AI Agent can only invoke ONE tool per execution.

Any additional suggestions would be greatly appreciated!

 
Posted : 28/04/2025 4:51 pm
interss
(@interss)
Posts: 10
Active Member
 

Hello
Good evening.

Access the options within your AI Agent and modify this setting.

See if increasing your interactions resolves your issue.

I'm available to assist you.

 
Posted : 30/04/2025 1:38 am
system
(@system)
Posts: 332
Reputable Member
 

This thread was automatically closed 90 days following the last response. New replies are no longer permitted.

 
Posted : 29/07/2025 1:39 am
Share: