EndNode

An EndNode marks the completion of a Flow path. It receives values from upstream nodes through data-flow edges and maps them to the enclosing Flow’s output contract. For a top-level Flow, the runtime returns these values to the API caller. For a nested Flow, the values become outputs available to the enclosing workflow.

EndNode Fields

FieldRequirementPurpose
component_typeRequiredIdentifies the component as an EndNode.
idRequiredUniquely identifies the node for references and graph connections.
nameRequiredProvides a human-readable component name.
inputsOptionalDeclares values received from upstream components as the path completes.
outputsOptionalDeclares the values mapped to the enclosing Flow’s output contract.
branchesOptionalAn EndNode has no outgoing branches; when included, this field is empty.
branch_nameOptionalIdentifies the branch selected by the Flow when this EndNode is reached.

Multiple Completion Paths

A Flow can contain different EndNode components for different valid paths. Each reachable path ends at an EndNode whose returned values satisfy the Flow's output contract.

For example, a return workflow can complete through either an eligible or an ineligible path:

Both EndNodes return the Flow output named response. The eligible path can return a confirmation that the return was created, while the ineligible path can return an explanation of why the request was denied. In both cases, response must satisfy the type declared by the Flow output contract.

EndNode Example

The order-support Flow returns one string named response:

Description of the illustration EndNode Output Completion Pattern

{
  "component_type": "EndNode",
  "id": "end",
  "name": "end",
  "inputs": [{"title": "response", "type": "string"}],
  "outputs": [{"title": "response", "type": "string"}],
  "branches": [],
  "branch_name": "next"
}

The preceding node connects to EndNode through a control-flow edge and supplies response through a data-flow edge. The returned JSON can then contain:

{"response": "Order 7812 is out for delivery."}

Complete Runnable Agent Spec

The following example places the EndNode in a complete Flow. The caller supplies an order-support response, StartNode publishes that value, and the data-flow edge supplies it to EndNode.response. The EndNode maps the value to the Flow output returned by DBMS_AI_AGENT.EXECUTE_IMMEDIATE.

SET SERVEROUTPUT ON SIZE UNLIMITED
SET DEFINE OFF

DECLARE
  L_AGENT_SPEC CLOB := q'~
{
  "component_type": "Flow",
  "agentspec_version": "25.4.1",
  "id": "end-node-example-flow",
  "name": "end_node_example_flow",
  "inputs": [
    {
      "title": "response",
      "type": "string"
    }
  ],
  "outputs": [
    {
      "title": "response",
      "type": "string"
    }
  ],
  "start_node": {
    "$component_ref": "start"
  },
  "nodes": [
    {
      "$component_ref": "start"
    },
    {
      "$component_ref": "end"
    }
  ],
  "control_flow_connections": [
    {
      "component_type": "ControlFlowEdge",
      "id": "start-to-end",
      "name": "start_to_end",
      "from_node": {
        "$component_ref": "start"
      },
      "to_node": {
        "$component_ref": "end"
      }
    }
  ],
  "data_flow_connections": [
    {
      "component_type": "DataFlowEdge",
      "id": "response-to-end",
      "name": "response_to_end",
      "source_node": {
        "$component_ref": "start"
      },
      "source_output": "response",
      "destination_node": {
        "$component_ref": "end"
      },
      "destination_input": "response"
    }
  ],
  "$referenced_components": {
    "start": {
      "component_type": "StartNode",
      "id": "start",
      "name": "start",
      "inputs": [
        {
          "title": "response",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "response",
          "type": "string"
        }
      ],
      "branches": [
        "next"
      ]
    },
    "end": {
      "component_type": "EndNode",
      "id": "end",
      "name": "end",
      "inputs": [
        {
          "title": "response",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "response",
          "type": "string"
        }
      ],
      "branches": [],
      "branch_name": "next"
    }
  }
}
~';

  L_INPUTS CLOB := TO_CLOB (
    '[{"name":"response","value":"Order 7812 is out for delivery."}]'
  );
  L_OUTPUTS CLOB;
BEGIN
  L_OUTPUTS := DBMS_AI_AGENT.EXECUTE_IMMEDIATE (
    AGENT_SPEC => L_AGENT_SPEC,
    INPUTS     => L_INPUTS
  );

  DBMS_OUTPUT.PUT_LINE (
    DBMS_LOB.SUBSTR (L_OUTPUTS, 32767, 1)
  );
END;
/

The returned JSON has the following form:

{
  "response": "Order 7812 is out for delivery."
}

In this execution:

  1. The execution input named response enters the Flow through StartNode.
  2. StartNode publishes the value through its response output.
  3. The data-flow edge transfers the value to EndNode.response.
  4. The control-flow edge describes execution continuing from StartNode to EndNode.
  5. EndNode maps its response value to the enclosing Flow output.
  6. EXECUTE_IMMEDIATE returns that Flow output to the API caller.