Final Output Node
The Final Output Node represents the end of your workflow. Your workflow may have multiple Final Output Nodes if the execution has been branched off from an upstream node.
A name for the output and an output type must be configured here because the response streamed back from the endpoint (when the workflow is taken to production) has this information included.
Expression Inputs
Final Output Nodes support Expression inputs, allowing you to do more with the values you reference. Instead of simply passing through a value from another node, you can write expressions to transform or extract specific data.
For example, you can:
- Access specific attributes from JSON outputs using the accessor syntax
- Perform simple transformations on values
- Combine multiple values into a single output
This is particularly useful when working with structured outputs from Prompt Nodes where you need to extract specific fields from a JSON response.
Using Fallbacks with Multiple Execution Paths
When your workflow has multiple execution paths that need to converge at a single Final Output Node, you can use the fallback operator (??
) to select the appropriate value based on which path was executed.
For example, in a workflow that classifies input and then routes to different Prompt Nodes based on the classification, you can use the fallback operator to select the output from whichever path was executed:
This expression will return the value from “Haiku about Dogs” if it exists, otherwise it will return the value from “Haiku about Cats”.
Here’s an example workflow that randomly classifies input as either “dog” or “cat”, then routes to the appropriate Prompt Node to generate a haiku about that animal:
The Final Output Node uses the fallback operator to select the output from whichever path was executed:
The routing is controlled by Ports on the Prompt Node, which direct the flow based on the classification output:
This pattern is especially useful when:
- You have conditional execution paths that produce similar outputs
- You want to simplify your workflow by using a single Final Output Node
- You need to handle cases where only one of several possible nodes will execute