Skip to content
Docs

Nodes

A node is a single step in a flow. The Publicus runtime walks from node to node, calling each one’s execute() method and handing its JSON output to the next connected node, which reads it as $prev. Everything a flow does — polling an API, reshaping JSON, inserting rows, calling an LLM — is a node doing its one specific job.

This page explains how nodes are put together, the handle types they use to connect, and every built-in node grouped by the role it plays.

Every node is made of three pieces, and you will see all three in the builder:

  1. An executor class under app/Flows/Nodes/… that extends App\Flows\Nodes\Node and implements a single execute(): ?string method. It reads context from the current activity, performs its work, and returns JSON.
  2. An Instructions DTO (*Instructions.php) — a Spatie Laravel Data class that declares the node’s configurable fields. The Filament builder introspects this class to render the form you see on the node’s right-hand panel. The fields on that form are the typed properties of the DTO.
  3. A set of handles — the coloured dots on the node’s border that you draw edges between. A node’s handles are declared by its $handles collection and are driven by the FlowHandleType enum.

When a flow runs, each node receives a WorkflowActivityData payload carrying the run’s context, and its instructions are hydrated into the matching Instructions DTO. Expression fields inside those instructions read the bound roots:

  • $prev: the JSON returned by the previous node in the chain.
  • $start: the payload that started the flow.
  • $kv: the Key-Value Store, read by name with $kv->myKey.

Every string instruction field accepts expressions such as {{ $prev->customerId }} or {{ $kv->lastRun }}. The expression engine resolves them right before the executor runs, so every field on the form can be dynamic. How-to: Use expressions covers the full syntax.

Handles are the ports on a node where edges start or end. A node only exposes the handles that match its role, which is why Start has no input and ConditionalExit has no output when its condition rejects the record.

The ten handle types live in App\Models\Enum\FlowHandleType:

Handle Where it appears What it means
input Top of most action nodes Accepts the output of the previous node.
output Bottom of most nodes, right of the Agent node Emits JSON forward to the next node’s input. A node whose edges all go into an agent’s attachment ports draws it on its top edge, facing the agent.
trigger Start only Marks the node that starts the flow. Exactly one trigger handle per flow.
schedule Schedule only Identifies a flow driven by a cron expression. Replaces input/output.
webhook Webhook only Identifies a flow driven by an inbound HTTP request against a registered webhook.
iteration Connectors (Parallel, Pager/OffsetBased, Pager/PageBased) The port that fans out into a child flow, once per page or split item.
tool The Agent node Attaches tool-providing nodes (MCP tools, operation packs, subagents) the agent can call.
memory The Agent node Attaches memory nodes (Chat Thread, Governed, Summary) the agent recalls from and records to.
middleware The Agent node Attaches context-shaping nodes that filter, reorder, or search the agent’s tool set each turn.
model The Agent node Attaches a model-routing node that decides which model serves each request.

The last four are the Agent node’s attachment ports — they wire capabilities onto an agent rather than passing data through it. They sit along the Agent node’s bottom edge, left to right: tool, memory, model, middleware (labelled Context). See AI & agent nodes below.

An edge can only be drawn between compatible handles — output to input, a connector’s iteration handle into the child subgraph’s input, or a tool/memory/middleware/model provider into the matching attachment handle on an Agent. The runtime validates these when you save the flow.

Publicus ships the following nodes. They are grouped here by what they do, not by their folder. Every entry names the class under app/Flows/Nodes/… so you can jump to the source when you need to.

These nodes start the flow. A flow has exactly one of them and it has no input handle.

  • Start: the manual / default entry point. It exposes an output and a trigger handle and carries the run’s start payload, which expressions read as $start. Every flow has one, even scheduled or webhook-driven flows, because the builder uses it as the graph’s starting point.
  • Schedule / Schedule — fires the flow on a cron schedule. Instructions: cronExpression (validated by App\Rules\CronExpression) and withoutOverlapping. Whether it fires is a separate Active switch on the node’s canvas badge. See Triggers for the runtime behaviour.
  • Webhook / Webhook — binds the flow to a registered webhook. Instructions: webhookId (select an existing Webhook record) and withoutOverlapping, plus the Active switch on its canvas badge. The webhook record itself is managed from Webhooks.
  • Webhook / Chat — a conversational variant of the webhook trigger. It normalizes the inbound request into a thread id, message, and metadata so an agent downstream can reply in context, and adds a maxHistory setting for how much of the conversation to keep. See Conversational channels.
  • Webhook / Gateway — binds the flow to a Discord or Slack bot under Chat apps whose socket Publicus holds open (the Discord gateway, Slack Socket Mode), so its messages start the flow. Unlike the other webhook variants it has no withoutOverlapping option.
  • Signal / Await — waits for an external signal before the flow continues. Instructions: event (the signal name). The runtime blocks the activity until a matching WorkflowSignal is recorded.

Anything that speaks to a remote service lives here.

  • Rest / Operation — a generic HTTP client. Instructions: uri, method (GET/POST/PUT/DELETE/PATCH), headers, body, credential. Use this when you do not have an OpenAPI spec to import.
  • OpenApi / Operation / Operation (and its Get / Post aliases) — the structured HTTP caller. You pick an OpenApiSchemaOperation (imported from a schema under API schemas) and the node fills in path, query, headers and body using typed parameters. Auth comes from credential, which holds either a connection or a secret, or from a literal authorization header.
  • Wsdl / Operation / Operation — the SOAP equivalent. Instructions: operation (selected from an imported WSDL), endpoint, headers, parameters. See SOAP services.

These nodes reshape the JSON flowing through the graph without any side effects.

  • Injector / Injector — emits a constant JSON document. Instructions: data (the literal JSON). Useful for seeding a flow with fixtures or for supplying a static request body.
  • Mapper / Mapper — renames keys on the incoming JSON. Instructions: a list of { from, to } pairs. Keys not matched are left untouched.
  • Transformer / Transformer — rewrites the input with a JSON template. Instructions: template. Build the document with a @json block that resolves quoted "$.path" references, or as raw text that embeds computed values with {!! ... !!} echo tags, because {{ ... }} HTML-escapes output that the next node consumes as JSON. This is the node you reach for to compose a request body from multiple sources.
  • TextExpression / TextExpression — evaluates a single expression against the current context and emits its result as JSON. Instructions: expression.
  • Faker / Faker — generates fake data from a template using FakerPHP. Instructions: template (a JSON document whose strings are resolved via a NameGuesser — e.g. name, email, company) and optional locale. Handy for seeding test flows.
  • Switch / Switch — routes the run down exactly one of several outgoing branches. Instructions: an ordered list of cases, each with a label, a condition expression, and the branch it targets. Cases are evaluated top to bottom; the first truthy condition wins and every other branch is skipped. An optional default branch catches the “nothing matched” case — without one, the run ends at the Switch. See the Switch reference.
  • ConditionalExit / ConditionalExit — stops a flow branch early when a predicate evaluates truthy. Instructions: condition (a bare boolean expression) and optional message. The node passes the upstream output through on both paths, so $prev downstream of the gate still reads the data that entered it. When the condition is truthy the run stops at this node and records the message; when falsy the flow continues.

These nodes read or write one of the three built-in storage primitives. See Storage overview for the stores themselves.

  • KeyValueStore / Get & KeyValueStore / Set — fetch or write a single KV entry. Instructions: keyValueStoreId (and value for Set). Set overwrites the value; Get emits the current value as the node’s output.

  • TableStore / Insert, TableStore / Upsert, TableStore / Query — CRUD against a Table Store. Insert and Upsert take tableStoreId and map the incoming JSON against the table’s declared columns; Query runs a sqlite-compatible query with optional bind parameters.

  • Database / Insert, Database / Upsert, Database / Select, Database / Execute — the same operations against an external database, plus Execute for non-SELECT statements (DDL or DML). You pick a secretCredentialId (a secret of type Database credentials) and supply extraCredentials overrides, a table, a query and parameters.

    The Add a node picker searched for Database, listing Database Execute, Database Insert and Database Select under Storage
    The Add a node picker searched for Database, listing Database Execute, Database Insert and Database Select under Storage

These nodes turn a flow into a chat completion or a full agent. Each has its own page under the Node reference, so this is only the map:

  • Llm / Agent — an autonomous agent that loops with a model, calls tools, and can pause for human approval. Tools, memory, context shaping, and model routing attach through the dedicated handles described above. See Llm / Agent.
  • Llm / Chat — a single prompt to an LLM with no tool loop. See Llm / Chat.
  • Subflow — runs another flow as a tool the agent can call. See Subflow.
  • Model routing — a small family (static model, fallback chain, rule router, LLM router, cost router) that decides which model serves each agent request, with failover. See Model routing.
  • Context shaping (middleware) — limits, reorders, or auto-narrows the tool set an agent is offered before each turn. See Agent context shaping.
  • Mcp / Tools — exposes a remote MCP server’s tools to an agent. See Mcp / Tools.
  • Chat Thread, Governed, and Summary attach to the agent’s memory handle and give it, respectively, conversation history, durable human-reviewed facts, and rolling turn summaries. Memory explains all three.

  • Memory / Enforce — a regular in-flow node (no agent required) that checks a proposed action against stored memory constraints and emits the decision as output, so a downstream node can branch on it or stop the run.

    A flow where an Enforce policy node is wired straight from Start, with no agent in the flow
    A flow where an Enforce policy node is wired straight from Start, with no agent in the flow

The retrieval family builds ingestion and semantic-search pipelines over Knowledge bases:

  • Read a File as Text — reads a stored file, an email attachment, a web page or raw text into the flow as plain text. It sits under Transform & data in the node picker; the others are under AI.
  • Split Text — splits text into chunks sized for embedding.
  • Contextualize Chunks — has a model write situating context for each chunk before it is embedded.
  • Embed — turns chunks into embedding vectors.
  • Knowledge Base Insert, Knowledge Base Query & Knowledge Base Delete — write embedded documents into a knowledge base, retrieve the most similar documents for a query, and remove sources.
  • Read Knowledge Base — reads a whole knowledge base, or one source, without searching.
  • When Knowledge Base Sources Change — a trigger that starts a flow when a knowledge base’s documents are added, replaced or deleted.

See Build an agent for a worked RAG pipeline.

One node per chat platform — Channel / Slack, Channel / Discord, Channel / Teams, Channel / Telegram, Channel / WhatsApp — each sends a message to that platform, typically as the reply leg of a conversational agent. Every one has its own reference page (for example Channel / Slack); see Conversational channels for how they pair with the Chat and Gateway triggers.

Connectors are not regular nodes. They live under app/Flows/Connectors and implement ConnectorInterface or PagerInterface. What makes them different is that they spawn child workflows through their iteration handle — each iteration is a full activity in its own right, with its own entry in the run report.

  • Split / Parallel — splits an input array and runs every element as a parallel child flow. Instructions: splitPath (a JSONPath, default $). Results of the children are aggregated before the main flow continues.
  • Pager / OffsetBased — drives a paginated API one page at a time using offset + size. Instructions: startPage, startSize, startOffset, nextPageProperty, nextSizeProperty, nextPage, nextOffset, nextSize, endCondition, combinePagesOutput. The next* expressions are evaluated against the $page context before each page runs, and endCondition is the one field that may read $page->prevOutput, so you stop paging when a page comes back empty.
  • Pager / PageBased — page + size variant. Same shape as above without the offset fields.

Because connectors spawn child flows, the subgraph wired to the iteration handle behaves like a miniature flow with its own Start: anything downstream of the connector’s output handle only runs after every iteration completes.

Expression fields resolve before the node runs. Embed values with {{ ... }} echo tags, or {!! ... !!} when the result is structured text that a later node consumes. The most common roots you will use:

Root What it holds
$prev JSON emitted by the upstream node.
$start Payload the flow was started with.
$kv->myKey Any entry from the Key-Value Store.
$page Only inside a Pager: the current page’s context + index.

Every string instruction field runs through this resolver, which is why you can build a request body, a Faker template, or the values in a Database node’s Parameters map entirely from dynamic expressions. SQL bodies take bare :name placeholders matched to the Parameters map; the driver binds the values, so they are never quoted into the SQL text.

  • Node reference — per-node configuration tables for every built-in node.
  • Data mapping — full JSONPath and expression syntax reference.
  • Connectors — Split/Parallel and Pager connector reference.
  • Flows — how nodes are composed into a graph.
  • Triggers — the ways a flow can start.
  • Memory — the memory nodes agents attach to.
  • Runs — how a run is tracked and debugged once the nodes start firing.