> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryblend.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LLM

> Runs a language model on a prompt. Works as a standard step (Agent) or as an on-demand helper other agents can call (Sub-agent).

The LLM node sends a prompt to a language model and produces its response for the next node to use. You pick the model, write the prompt and system instructions, and optionally connect tools the model can call.

It has two modes: **Agent**, a normal step that always runs as part of the flow, and **Sub-agent**, a helper that doesn't run on its own but is exposed to a main agent as a callable tool.

## Modes

Set the mode with the **Used as** dropdown at the top of the node. Everything else, including model, prompt, and tools, is configured the same way in both modes.

Only how the node participates in the flow changes. For the full picture of how agents call tools and sub-agents, see [Agents and tools](/workflow/agents-and-tools).

<CardGroup cols={2}>
  <Card title="Agent" icon="robot">
    A standard LLM step. It receives its prompt, runs the model, and produces an output the next node can use. Pick this when the node should always run as part of the flow.
  </Card>

  <Card title="Sub-agent" icon="user-group">
    A specialized helper other agents call on demand. It does not run on its own; a main agent reads its tool description and decides whether the task needs it.
  </Card>
</CardGroup>

## Inputs

Input handles are on the **left** of the node.

| Handle                    | Type                                                     | Required | Notes                                                                                                                                                                                                                                                                                                      |
| ------------------------- | -------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Prompt / model parameters | `text` (and other types depending on the selected model) | No       | The prompt and any other model parameters can be filled in on the node or fed from upstream nodes. Type `{{variable}}` in a text-area parameter to create one `text` handle per variable. In **Sub-agent** mode the prompt is reserved for the main agent that calls the node, so it has no prompt handle. |
| Model                     | `model`                                                  | No       | Optional handle to drive the model selection from an upstream node instead of picking it on the node.                                                                                                                                                                                                      |
| Tools (`tools_in`)        | `tool-list`                                              | No       | Accepts connections from [Tool](/workflow/nodes/tool) nodes and from Sub-agents. This handle accepts **multiple** connections — wire as many tools and sub-agents into one agent as you need.                                                                                                              |

## Outputs

Output handles are on the **right** of the node.

| Handle                          | Type        | Notes                                                                                                                                                                                                   |
| ------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Output                          | `text`      | The model's response. Present in **Agent** mode when no structured output schema is configured.                                                                                                         |
| One handle per structured field | `text`      | Appears when structured output is configured. Values are serialized as text on the wire: strings stay strings, numbers become numeric text, and list values in a non-fan-out schema become JSON arrays. |
| Tool out (`tool_out`)           | `tool-list` | Only appears in **Sub-agent** mode. Wire it into a main Agent's tools input so that Agent can call this sub-agent. A sub-agent does not produce a normal flow output.                                   |

## Settings

* **Used as** — the mode dropdown: **Agent** or **Sub-agent**.
* **Model** — the language model that runs. Filtered to models that produce text output.
* **Prompt** — the instruction the model acts on. Type `{{topic}}` or another variable token to expose a dedicated input handle for that part of the prompt. In **Sub-agent** mode the prompt is reserved for the main agent and isn't editable on the node.
* **System instructions** — the model's standing behavior, separate from the per-run prompt.
* **Structured output** — optional output fields that make the model return a structured object instead of free text.
* **Tools** — connect [Tool](/workflow/nodes/tool) nodes and Sub-agents via the tools input to give the model abilities it can call.
* **Advanced Settings** — extra model parameters (such as temperature) under a collapsible section. The available parameters depend on the selected model.

In **Sub-agent** mode, two more settings appear:

* **Tool name** — a short identifier the parent agent uses to call this sub-agent (for example `research_assistant`). Spaces and invalid characters are cleaned up automatically.
* **Tool description** — tells the parent agent when to call this sub-agent. Be specific about the task it handles; the main agent reads this to decide whether to invoke it.

## Structured output

Structured output lets an Agent produce named fields instead of one free-text response. Add fields in the structured output builder, give each field a name, and connect downstream nodes to the field handles you need.

Each field can use one of six shapes:

| Field shape | Configuration                                               |
| ----------- | ----------------------------------------------------------- |
| String      | Free text                                                   |
| Number      | Optional minimum and maximum                                |
| Enum        | One value from the options you provide                      |
| String list | A list of strings with optional minimum/maximum item counts |
| Number list | A list of numbers with optional value and item-count bounds |
| Enum list   | A list whose entries come from the provided options         |

Fields can be mixed freely, including multiple list fields. The **overall schema shape** determines whether the node fans out:

| Overall schema                          | Output behavior                                                                            |
| --------------------------------------- | ------------------------------------------------------------------------------------------ |
| Exactly one list field and nothing else | Emits one output item per list element. Downstream nodes run once per element, like Batch. |
| Scalars only                            | Emits one shared item with one handle per field.                                           |
| Scalars mixed with lists                | Emits one shared item. Each list handle carries its value as JSON array text.              |
| Multiple list fields                    | Emits one shared item with a JSON array on each list handle.                               |

<Note>
  A list fans out only when it is the schema's sole field. Adding another scalar or list field changes the result to one shared item.
</Note>

For example, `title` plus `description` exposes two handles on one item. A sole `ideas[]` field containing five values emits five items. A `title` plus `tags[]` schema emits one item, with `tags` serialized as JSON text on its handle.

Field names must start with a letter or underscore and contain only letters, numbers, and underscores. Names ending in `_<number>` are reserved for item ordinals. Enum fields need at least one option.

Number ranges and minimum list lengths guide the model. A list's **maximum item count** is also enforced as a hard output cap and contributes to the pre-run count and cost estimate.

<Warning>
  List-shaped response fields cannot be used when Batch, a sole-list LLM, or multiple-choice Choose Output already sends this LLM several items. That would create a list of lists. Switch the response fields to **Single**, or remove the upstream fan-out.
</Warning>

Structured output runs as object generation. Tool calling is skipped for that run shape, so use normal Agent mode without a schema when the model should actively call tools while composing the answer.

## Sub-agent mode

A sub-agent does not run as part of the main flow. Instead, a **main Agent** reads its **tool name** and **tool description** and decides, mid-run, whether the current task needs it.

This lets you split a big problem into focused roles, such as researcher, writer, or validator, that the main agent orchestrates.

To use one:

<Steps>
  <Step title="Set the mode to Sub-agent">
    Give it a **Tool name** and a clear **Tool description** so the parent agent knows when to call it.
  </Step>

  <Step title="Wire its output into a main Agent">
    Connect the sub-agent's **Tool out** (`tool_out`) into a main Agent's **Tools** input — either directly, or through a [Tool](/workflow/nodes/tool) node. The main Agent now sees the sub-agent as one of its callable tools.
  </Step>
</Steps>

Constraints to keep in mind:

* **Max sub-agent depth is 5.** Sub-agents can call sub-agents, but the call chain can't nest deeper than five levels.
* **Tool names must be unique per parent agent.** Two sub-agents wired into the same Agent can't share a tool name.
* **No sub-agent cycles.** A sub-agent can't call back into a chain that leads to itself.

See [Agents and tools](/workflow/agents-and-tools) for the full model, and the [Tool node](/workflow/nodes/tool) for wiring built-in tools.

## When to use

* **Agent** — for any step that should always run: drafting text, summarizing, classifying, transforming an upstream result, or driving tools toward a fixed task.
* **Sub-agent** — when a main agent should decide *at run time* whether a specialized capability is needed. Good for splitting work into named roles the main agent calls only when relevant.

## Connects to

* **Upstream** — [User Input](/workflow/nodes/input) nodes feeding the prompt or parameters; other nodes producing text/media the model should act on; [Tool](/workflow/nodes/tool) nodes and Sub-agents into the tools input.
* **Downstream** — the next node in the flow consumes the Agent's output. A Sub-agent instead feeds its `tool_out` into a main Agent.

## Notes / limits

* Tools input accepts multiple connections; the model's output, prompt, and parameters depend on the selected model.
* Structured output replaces the default free-text output with named field handles.
* A structured list creates multiple output items only when it is the schema's sole field.
* An Agent can run by itself; a Sub-agent cannot and must be connected to a parent Agent.
* Max sub-agent depth is **5**.
* Tool names must be **unique per parent agent**.
* **No sub-agent cycles** — the call graph must stay acyclic, like the rest of the canvas (no cycles or self-connections).
* Connection compatibility follows the standard rules: exact-type matches connect, `any` connects to anything except `tool-list`, `tool-list` only connects to `tool-list`, and media types can feed a `file` target.

## Next steps

<CardGroup cols={2}>
  <Card title="Agents and tools" icon="robot" href="/workflow/agents-and-tools">
    How agents call tools and sub-agents — the deep dive on orchestration.
  </Card>

  <Card title="Tool node" icon="wrench" href="/workflow/nodes/tool">
    Wire built-in tools (and sub-agents) into an agent's tools input.
  </Card>
</CardGroup>
