langflow
langflow copied to clipboard
feat: store message in agent component
This pull request introduces several changes to the agent components in the Langflow backend. The main updates include adding a method to store agent history and incorporating new imports to support this functionality.
New functionality:
-
src/backend/base/langflow/base/agents/agent.py
: Added an abstract methodstore_agent_history
to store the message in memory. -
src/backend/base/langflow/components/agents/agent.py
: Implemented thestore_agent_history
method to store the message usingStoreMessageComponent
.
Import updates:
-
src/backend/base/langflow/components/agents/agent.py
: Added imports foroverride
,StoreMessageComponent
,MESSAGE_SENDER_NAME_USER
, andMESSAGE_SENDER_USER
to support the new functionality. [1] [2]
Enhancements to message handling:
-
src/backend/base/langflow/components/agents/agent.py
: Modified themessage_response
method to create aMessage
object ifinput_value
is present and store it in agent history. -
src/backend/base/langflow/components/agents/agent.py
: Updatedmessage_response
to store the agent history after running the agent.