refactor: update inputs in ToolCallingAgentComponent
and add astream_events setup
#4240
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several enhancements and refactorings to improve agent processing and streamline the codebase. The most significant changes include adding a new method for processing agent events, updating type imports, and modifying input handling in the
ToolCallingAgentComponent
.Enhancements to agent processing:
src/backend/base/langflow/base/agents/agent.py
: Addedprocess_agent_events
method to handle different agent events asynchronously, improving the logging and processing of agent events.src/backend/base/langflow/base/agents/agent.py
: Updatedrun_agent
method to useprocess_agent_events
for better event handling and logging.Codebase simplification:
src/backend/base/langflow/base/agents/agent.py
: Replacedtyping.cast
withcollections.abc.AsyncIterator
for more accurate type hinting.Input handling improvements:
src/backend/base/langflow/components/agents/tool_calling.py
: ReplacedMultilineInput
withMessageTextInput
forsystem_prompt
andinput_value
to better represent the input data.src/backend/base/langflow/components/agents/tool_calling.py
: Updatedcreate_agent_runnable
to useinput_value
directly and ensure tools are provided as an empty list if not specified.