Agent calling two or more tools at same time #27755
Replies: 3 comments 10 replies
-
I found some relevant information regarding your question. The structured chat agent in LangChain can handle multiple tool invocations in a single user input using a multi-hop approach. This allows the agent to use multiple tools in sequence to complete a task. Each action is specified in a separate JSON blob, like this: {
"action": $TOOL_NAME,
"action_input": $INPUT
} The agent processes the input by repeating the Thought/Action/Observation cycle multiple times if necessary, with each action encapsulated in its own JSON blob. This ensures that the agent handles each tool invocation separately and sequentially [1][2][3]. Additionally, there was a similar closed issue where it was suggested to modify the agent's iteration logic to include a decision-making process about whether to use a tool, which can help in managing multiple tool calls effectively [4]. |
Beta Was this translation helpful? Give feedback.
-
@dosu But in a practical way, how can I use two tools at the same time in an input, for example, I want the numbers 3 and 4 to be added, multiplied, and these commands to be executed using two different tools? |
Beta Was this translation helpful? Give feedback.
-
@dosu Recently I have been facing a Pydantic error, in the tool I declare a variable, for example observation: list[str] = None. It is not mandatory, when this information is not sent, the agent returns it as observation: "", which generates an error since I defined it as a list[str], how can I avoid this error? {
"action": "input_aptidao",
"action_input": {
"cdfazenda": "26250",
"numero": ["1121", "5465", "548", "4488", "64830"],
"data": ["31/10/2024", "30/10/2024", "27/10/2024", "31/10/2024", "28/10/2024"],
"peso": ["500", "350", "150", "320", "440"],
"observacao": ""
}
}
```1 validation error for input_aptidao
observacao
Input should be a valid list [type=list_type, input_value='', input_type=str]
For further information visit https://errors.pydantic.dev/2.9/v/list_type |
Beta Was this translation helpful? Give feedback.
-
I would like to know if there is a way to call two tools in a user input using the structured chat agent, for example in the input the user to perform two procedures that require two different tools, and the agent identifies and activates these two tools in the same input.
Beta Was this translation helpful? Give feedback.
All reactions