LLMNode

A LlmNode represents a single model invocation within a Flow. It performs a predetermined model task, such as summarization, classification, or text generation. Unlike an AgentNode, it does not perform an iterative model-and-tool loop or invoke tools.

When the LlmNode executes, it receives typed values through its declared inputs, incorporates those values into its prompt template, and invokes the model specified by its LLM configuration. The model response is mapped to the node's declared outputs.

LLMNode Fields

FieldRequirementPurpose
component_typeRequiredIdentifies the component as an LlmNode.
idRequiredUniquely identifies the node for references and graph connections.
nameRequiredProvides a human-readable component name.
llm_configRequiredIdentifies the LLM configuration used for the model invocation.
prompt_templateRequiredDefines the model task and incorporates values from the node’s named inputs.
inputsOptionalDeclares the typed values available to the prompt template.
outputsOptionalDeclares the typed values produced from the model response.
branchesOptionalDeclares named branches that outgoing control-flow edges can reference.

The configured provider, url, model, generation parameters, and expected response format must be mutually compatible. The credential_name field references the database credential used for authentication; secret values are not stored in the Agent Spec.

LLMNode Example:

This LlmNode receives an order-support request, incorporates it into a prompt, and produces a summary:

Description of the illustration LLMNode Request-Summarization Flow

{
  "component_type": "LlmNode",
  "id": "summarize-request",
  "name": "summarize_request",
  "inputs": [{"title": "request", "type": "string"}],
  "outputs": [{"title": "summary", "type": "string"}],
  "branches": ["next"],
  "llm_config": {"$component_ref": "support-llm"},
  "prompt_template": "Summarize this order-support request: {{request}}"
}

How Prompt Rendering Works

The input declaration establishes a string input named request. An incoming data-flow edge supplies its value by identifying request as the destination input:

{
    "component_type": "DataFlowEdge",
    "id": "request-to-summary",
    "name": "request_to_summary",
    "source_node": {
      "$component_ref": "start"
    },
    "source_output": "request",
    "destination_node": {
      "$component_ref": "summarize-request"
    },
    "destination_input": "request"
  }

Suppose the data-flow edge supplies this value:

Where is order 7812? It was expected yesterday.

When the LlmNode executes, the runtime resolves the {{ request }} variable from the node input with the same name. The variable name is case-sensitive and must match the input title exactly.

The prompt template:

Summarize this order-support request: {{ request }}

is rendered as:

Summarize this order-support request: Where is order 7812? It was expected yesterday.

The runtime sends the rendered prompt to the model identified by support-llm. The model response is interpreted according to the node's output contract and becomes the value of summary.

An outgoing data-flow edge can map that output to an input with a different name:

LlmNode.summary --DataFlowEdge--> EndNode.response

The explicit edge performs the mapping from summary to response; the two endpoint names do not need to be identical.

Complete Runnable Agent Spec

The following complete Flow accepts an order-support request, uses an LlmNode to summarize it, and returns the summary through the Flow output named response.

Before running the example:

  • Create the database credential named AI_PROVIDER_CREDENTIAL.
  • Grant the executing database principal network access to api.openai.com.
  • Replace the provider, endpoint, model, and credential name if your environment uses different values.

For the complete setup procedure, see LLM Configuration, Credentials, and Network Access.

SET SERVEROUTPUT ON SIZE UNLIMITED
SET DEFINE OFF

DECLARE
  L_AGENT_SPEC CLOB := q'~
{
  "component_type": "Flow",
  "agentspec_version": "25.4.1",
  "id": "llm-node-example-flow",
  "name": "llm_node_example_flow",
  "inputs": [
    {
      "title": "request",
      "type": "string"
    }
  ],
  "outputs": [
    {
      "title": "response",
      "type": "string",
      "default": ""
    }
  ],
  "start_node": {
    "$component_ref": "start"
  },
  "nodes": [
    {
      "$component_ref": "start"
    },
    {
      "$component_ref": "summarize-request"
    },
    {
      "$component_ref": "end"
    }
  ],
  "control_flow_connections": [
    {
      "component_type": "ControlFlowEdge",
      "id": "start-to-summary",
      "name": "start_to_summary",
      "from_node": {
        "$component_ref": "start"
      },
      "to_node": {
        "$component_ref": "summarize-request"
      }
    },
    {
      "component_type": "ControlFlowEdge",
      "id": "summary-to-end",
      "name": "summary_to_end",
      "from_node": {
        "$component_ref": "summarize-request"
      },
      "to_node": {
        "$component_ref": "end"
      }
    }
  ],
  "data_flow_connections": [
    {
      "component_type": "DataFlowEdge",
      "id": "request-to-summary",
      "name": "request_to_summary",
      "source_node": {
        "$component_ref": "start"
      },
      "source_output": "request",
      "destination_node": {
        "$component_ref": "summarize-request"
      },
      "destination_input": "request"
    },
    {
      "component_type": "DataFlowEdge",
      "id": "summary-to-response",
      "name": "summary_to_response",
      "source_node": {
        "$component_ref": "summarize-request"
      },
      "source_output": "summary",
      "destination_node": {
        "$component_ref": "end"
      },
      "destination_input": "response"
    }
  ],
  "$referenced_components": {
    "start": {
      "component_type": "StartNode",
      "id": "start",
      "name": "start",
      "inputs": [
        {
          "title": "request",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "request",
          "type": "string"
        }
      ],
      "branches": [
        "next"
      ]
    },
    "summarize-request": {
      "component_type": "LlmNode",
      "id": "summarize-request",
      "name": "summarize_request",
      "inputs": [
        {
          "title": "request",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "summary",
          "type": "string",
          "default": ""
        }
      ],
      "branches": [
        "next"
      ],
      "llm_config": {
        "$component_ref": "support-llm"
      },
      "prompt_template": "Summarize this order-support request in one short sentence: {{request}}"
    },
    "end": {
      "component_type": "EndNode",
      "id": "end",
      "name": "end",
      "inputs": [
        {
          "title": "response",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "response",
          "type": "string"
        }
      ],
      "branches": [],
      "branch_name": "next"
    },
    "support-llm": {
      "component_type": "DbmsVectorChainLlmConfig",
      "id": "support-llm",
      "name": "support_llm",
      "provider": "openai",
      "url": "https://api.openai.com/v1/chat/completions",
      "model": "gpt-4.1-mini",
      "credential_name": "AI_PROVIDER_CREDENTIAL",
      "transfer_timeout": 120,
      "default_generation_parameters": {
        "max_tokens": 200,
        "temperature": 0.0,
        "top_p": 1.0
      }
    }
  }
}
~';

  L_INPUTS CLOB := TO_CLOB (
    '[{"name":"request","value":"Where is order 7812? It was expected yesterday."}]'
  );
  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 exact model wording can vary, but the returned JSON has the following shape:

{
  "response": "The customer is requesting an update for a delayed order."
}

In this execution:

  1. StartNode publishes the execution input through request.
  2. The first data-flow edge supplies that value to LlmNode.request.
  3. The LlmNode renders {{request}} in its prompt and invokes the model identified by support-llm.
  4. The model result becomes LlmNode.summary.
  5. The second data-flow edge maps summary to EndNode.response.
  6. EndNode returns the value through the Flow output named response.