fix(agent): allow agents to run without requiring any tools (#8533)
fix Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
1236643711
commit
d5eef7a669
18 changed files with 25 additions and 31 deletions
|
|
@ -124,15 +124,13 @@ class LCAgentComponent(Component):
|
|||
if isinstance(agent, AgentExecutor):
|
||||
runnable = agent
|
||||
else:
|
||||
if not hasattr(self, "tools") or not self.tools:
|
||||
msg = "Tools are required to run the agent."
|
||||
raise ValueError(msg)
|
||||
# note the tools are not required to run the agent, hence the validation removed.
|
||||
handle_parsing_errors = hasattr(self, "handle_parsing_errors") and self.handle_parsing_errors
|
||||
verbose = hasattr(self, "verbose") and self.verbose
|
||||
max_iterations = hasattr(self, "max_iterations") and self.max_iterations
|
||||
runnable = AgentExecutor.from_agent_and_tools(
|
||||
agent=agent,
|
||||
tools=self.tools,
|
||||
tools=self.tools or [],
|
||||
handle_parsing_errors=handle_parsing_errors,
|
||||
verbose=verbose,
|
||||
max_iterations=max_iterations,
|
||||
|
|
|
|||
|
|
@ -87,16 +87,12 @@ class AgentComponent(ToolCallingAgentComponent):
|
|||
msg = "CurrentDateComponent must be converted to a StructuredTool"
|
||||
raise TypeError(msg)
|
||||
self.tools.append(current_date_tool)
|
||||
|
||||
# Validate tools
|
||||
if not self.tools:
|
||||
msg = "Tools are required to run the agent. Please add at least one tool."
|
||||
raise ValueError(msg)
|
||||
# note the tools are not required to run the agent, hence the validation removed.
|
||||
|
||||
# Set up and run agent
|
||||
self.set(
|
||||
llm=llm_model,
|
||||
tools=self.tools,
|
||||
tools=self.tools or [],
|
||||
chat_history=self.chat_history,
|
||||
input_value=self.input_value,
|
||||
system_prompt=self.system_prompt,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue