End Node
The End Node is the final node in the Sequential Agent workflow, marking the conclusion of a conversation turn or the entire conversational flow. It receives all the accumulated context from previous nodes, including the conversation history and custom State, and provides the ultimate response back to the user.
Understanding the End Node
The End Node serves as the termination point for the Sequential Agent workflow, signaling that all necessary processing for the current conversation turn has been completed. It consolidates the outputs from all preceding nodes and delivers the final response to the user.
Key aspects of the End Node include:
- Final response delivery: The End Node sends the accumulated response back to the user, representing the culmination of all processing in the workflow.
- Conversation turn completion: It marks the end of a conversation turn, allowing the workflow to reset and prepare for the next user input.
- State preservation: While the conversation turn ends, the State (including conversation history and custom State) persists if an Agent Memory Node is connected to the Start Node, maintaining context across turns.
Inputs
The End Node has no configurable inputs. It simply receives the complete State object, including conversation history and any custom State variables, from the preceding node in the workflow.
Features
Final Response Selection
The response delivered to the user by the End Node is determined by the last assistant message in the conversation history (state.messages
). This message is typically generated by the last Agent Node or LLM Node that was executed before reaching the End Node.
Multiple End Points
A Sequential Agent workflow can have multiple End Nodes, allowing different conversation paths to terminate independently. This enables:
- Different conclusion points based on conversation flow
- Specialized response handling for different branches of the workflow
- Varied termination conditions depending on the user's needs or the workflow's purpose
State Persistence
If the workflow includes an Agent Memory Node connected to the Start Node, the State (including conversation history and custom State) persists even after the End Node is reached. This allows the workflow to maintain context across multiple conversation turns, enabling:
- Continuous conversations with full context preservation
- Progressive information gathering across multiple interactions
- Personalization improvements as the workflow learns more about the user
Best Practices
- Pro Tips
- Potential Pitfalls
Multiple End Nodes for clarity
Don't hesitate to use multiple End Nodes in complex workflows. Having dedicated End Nodes for different conversation paths can make your workflow more readable and easier to maintain.
Final State review
Before implementing an End Node, review the conversation history and State structure to ensure you're delivering the most appropriate final response to the user. Sometimes, an additional Agent Node or LLM Node before the End Node can provide a more cohesive summary or conclusion.
Missing End Node
- Problem: A Sequential Agent workflow is designed without an End Node, leaving the conversation without a proper conclusion point.
- Example: You create a workflow that processes user requests but doesn't include an End Node, causing the system to continue waiting for additional node executions that will never occur.
- Solution: Ensure every possible path through your workflow leads to an End Node. Use Condition Nodes or Condition Agent Nodes to route all possible conversation branches to appropriate conclusions.
Inappropriate final response
- Problem: The final response delivered to the user doesn't appropriately address their query or provide a satisfactory conclusion to the conversation.
- Example: A multi-step process collects all necessary information from the user but then terminates with a generic "Thank you" message rather than confirming the completion of the requested action.
- Solution: Review the complete conversation flow and ensure that the last Agent Node or LLM Node before each End Node generates an appropriate concluding message. Consider adding a final "summarizer" node before important End Nodes to ensure coherent closure.
Premature workflow termination
- Problem: The workflow reaches an End Node before completing all necessary processing or interactions.
- Example: A condition incorrectly routes the conversation to an End Node before all required user information has been collected.
- Solution: Review all conditions and branching logic to ensure End Nodes are only reached when appropriate. Consider adding state checks before critical End Nodes to verify that all required information has been gathered or processed.