Skip to main content

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

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.