StartNode

The enclosing Flow identifies one node through its start_node field. When execution begins, the runtime starts at that node.

Values supplied through the flow input contract become available through the StartNode’s named outputs. Downstream nodes receive those values only through declared data-flow connections.

StartNode Fields

Field Requirement Purpose
component_type Required Identifies the component as a StartNode.
id Required Unique identity used by the Flow reference and edges.
name Required Provides a human-readable component name.
inputs Optional Declares values accepted at the Flow-entry boundary.
outputs Optional Declares values that can be transferred to other nodes.
branches Optional Branches that outgoing control-flow edges can reference.

The Flow’s start_node reference, the StartNode id, and its referenced component key must agree where references are used.

StartNode Example

The caller supplies a string named request. The StartNode exposes that value as a named output that can be connected to another node:

Description of the illustration FlowComponent_StartNode-Page-3.png

{
  "component_type": "StartNode",
  "id": "start",
  "name": "start",
  "inputs": [
    {
      "title": "request",
      "type": "string"
    }
  ],
  "outputs": [
    {
      "title": "request",
      "type": "string"
    }
  ],
  "branches": ["next"]
}

This fragment defines only the StartNode. A separate control-flow edge describes a possible next node, and a separate data-flow edge transfers the request output to a declared input of a downstream node.

Complete Runnable Agent Spec

The following example places the StartNode in a complete Flow. The caller supplies request, the StartNode publishes it, and a data-flow edge transfers it to the EndNode. The Flow then returns the same value through its output contract.

SET SERVEROUTPUT ON SIZE UNLIMITED
SET DEFINE OFF

DECLARE
  l_agent_spec CLOB := q'~
{
  "component_type": "Flow",
  "agentspec_version": "26.1.0",
  "id": "start-node-example-flow",
  "name": "start_node_example_flow",
  "inputs": [
    {
      "title": "request",
      "type": "string"
    }
  ],
  "outputs": [
    {
      "title": "request",
      "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": "request-to-end",
      "name": "request_to_end",
      "source_node": {
        "$component_ref": "start"
      },
      "source_output": "request",
      "destination_node": {
        "$component_ref": "end"
      },
      "destination_input": "request"
    }
  ],
  "$referenced_components": {
    "start": {
      "component_type": "StartNode",
      "id": "start",
      "name": "start",
      "inputs": [
        {
          "title": "request",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "request",
          "type": "string"
        }
      ],
      "branches": [
        "next"
      ]
    },
    "end": {
      "component_type": "EndNode",
      "id": "end",
      "name": "end",
      "inputs": [
        {
          "title": "request",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "request",
          "type": "string"
        }
      ],
      "branches": [],
      "branch_name": "next"
    }
  }
}
~';

  l_inputs CLOB := TO_CLOB(
    '[{"name":"request","value":"Where is order 7812?"}]'
  );

  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:

{
  "request": "Where is order 7812?"
}

In this execution:

  1. The execution input named request enters the Flow through StartNode.

  2. StartNode publishes the value through its request output.

  3. The data-flow edge transfers the value to EndNode.request.

  4. The control-flow edge identifies EndNode as the possible next node after\

    StartNode.

  5. EndNode returns the value through the Flow output named request.