Skip to main content

Components

A component is a ready-made node: prompt templating, validation, parsing, retrieval, ranking, text processing. Components run inside the engine, without calling back into JavaScript, and they work on every runner, including runCatalogGraph.

createGraph({ name: "greet" })
.channel("name", { type: "string", default: "" })
.component("prompt", components.promptBuilder({ template: "Hello {{name}}!", into: "prompt" }));

Parameters named from, query or queryFrom name the channel a component reads; into names the channel it writes. The two integration components, httpFetch and webSearch, call external services and are added with .node().

To list components from code, use componentCatalog; for a JSON Schema of each component's parameters, componentSchemas().

promptBuilder​

Render every {{var}} placeholder from the channels into a target channel. Category: prompt. Use: .component(id, components.promptBuilder({...})).

ParameterTypeRequiredDescription
templatestringyesTemplate with {{var}} placeholders filled from the channels.
intostringyesChannel the rendered string is written into.

jsonValidator​

Validate a channel value's type and required keys, writing an ok flag and an errors list. Category: validation. Use: .component(id, components.jsonValidator({...})).

ParameterTypeRequiredDescription
fromstringyesChannel whose value is validated.
requiredKeysstring[]noRequired object keys to assert present.
expectType"string" | "number" | "boolean" | "object" | "array" | "null"noExpected JSON type.
okIntostringyesChannel receiving the boolean validity flag.
errorsIntostringyesChannel receiving the string[] of validation errors.

outputParser​

Extract the first balanced JSON object or array from a text channel. Category: parsing. Use: .component(id, components.outputParser({...})).

ParameterTypeRequiredDescription
fromstringyesText channel to extract the first JSON value from.
intostringyesChannel receiving the parsed value (or null when none is found).

router​

Pick a route string from a channel value by ordered match rules (pairs with a conditional edge). Category: routing. Use: .component(id, components.router({...})).

ParameterTypeRequiredDescription
fromstringyesChannel whose value is matched against the rules.
rulesRouterRule[]yesOrdered rules ({ equals?, contains?, route }); the first match wins.
defaultRoutestringyesRoute emitted when no rule matches.
intostringyesChannel the chosen route string is written into.

retriever​

Score candidate documents against a query and keep the top-k by similarity. Category: retrieval. Use: .component(id, components.retriever({...})).

ParameterTypeRequiredDescription
querystringyesChannel holding the query text (falls back to this literal when the channel is empty).
intostringyesChannel receiving the top-k { id, content, score } array.
knumbernoNumber of results to keep (default 4).
docsRetrieverDoc[]yesThe corpus ({ id, content }[]) to score against.

reranker​

Reorder a retrieval-result array, optionally re-scoring against a query embedding. Category: retrieval. Use: .component(id, components.reranker({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the retrieval-result array to reorder.
intostringyesChannel receiving the reordered array.
querystringnoOptional channel holding query text for embedding-based re-scoring.

textCleaner​

Normalise a text channel: strip HTML, lowercase, collapse whitespace, trim. Category: text. Use: .component(id, components.textCleaner({...})).

ParameterTypeRequiredDescription
fromstringyesChannel whose text is normalised.
intostringyesChannel receiving the cleaned text.
lowercasebooleannoLowercase the text. Defaults to false.
stripHtmlbooleannoStrip <...> HTML tags. Defaults to false.
collapseWhitespacebooleannoCollapse runs of whitespace to a single space. Defaults to false.
trimbooleannoTrim leading/trailing whitespace. Defaults to false.

documentSplitter​

Split a text channel into an array of chunk strings by chars or sentences. Category: text. Use: .component(id, components.documentSplitter({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the text to split.
intostringyesChannel receiving the string[] of chunks.
by"chars" | "sentences"yesSplit unit: sliding char windows or greedy sentence packing.
sizenumberyesWindow size in chars or sentences. Must be > 0.
overlapnumbernoOverlap repeated at the start of each next chunk. Defaults to 0.

htmlToText​

Strip HTML tags from a text channel and decode the common named entities. Category: text. Use: .component(id, components.htmlToText({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the HTML text.
intostringyesChannel receiving the tag-stripped, entity-decoded text.

csvParser​

Parse a CSV text channel into an array of row objects (or arrays). Category: parsing. Use: .component(id, components.csvParser({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the CSV text.
intostringyesChannel receiving the parsed rows array.
delimiterstringnoSingle-character cell delimiter. Defaults to ",".
headerbooleannoWhen true (default) the first row supplies object keys; otherwise rows are arrays.

documentJoiner​

Concatenate the array values across several channels into one merged array. Category: data. Use: .component(id, components.documentJoiner({...})).

ParameterTypeRequiredDescription
fromChannelsstring[]yesChannels whose array values are concatenated in order.
intostringyesChannel receiving the merged array.
dedupeBystringnoOptional object field to de-duplicate the merged items by.

deduplicator​

De-duplicate an array channel, keeping the first occurrence and preserving order. Category: data. Use: .component(id, components.deduplicator({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the array to de-duplicate.
intostringyesChannel receiving the de-duplicated array.
keystringnoOptional object field to compare items by (else whole-value compare).

truncator​

Truncate a text channel to at most maxChars characters with an ellipsis. Category: text. Use: .component(id, components.truncator({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the text to truncate.
intostringyesChannel receiving the (possibly truncated) text.
maxCharsnumberyesMaximum character length (the ellipsis counts against this budget).
ellipsisstringnoSuffix appended when truncated. Defaults to "…".

regexExtractor​

Extract literal-pattern matches (with ^/$ anchors) from a text channel. Category: parsing. Use: .component(id, components.regexExtractor({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the text to match against.
intostringyesChannel receiving the match (or matches when all).
patternstringyesLiteral-substring pattern with optional leading ^ and trailing $ anchors.
groupnumbernoAccepted for forward-compat; only 0 (the whole match) is supported. Defaults to 0.
allbooleannoWhen true, return every non-overlapping occurrence as an array. Defaults to false.

answerBuilder​

Assemble a final answer string, optionally appending numbered citations. Category: text. Use: .component(id, components.answerBuilder({...})).

ParameterTypeRequiredDescription
fromstringyesChannel supplying the core answer text.
intostringyesChannel receiving the assembled answer.
contextFromstringnoOptional channel holding a retrieval-result array rendered as numbered citations.
templatestringnoOptional {{answer}}/{{citations}} template controlling the layout.

fieldMapper​

Remap an object channel's fields (by dotted path) into a new object. Category: data. Use: .component(id, components.fieldMapper({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the source object.
intostringyesChannel receiving the remapped object.
mappingRecord<string, string>yes{ outKey: inKeyPath } map; inKeyPath is a dotted path into the source.

fieldExtractor​

Extract a scalar from a channel: follow an optional dotted path, and (finalOnly) reduce an agent reasoning trace to the text after the last "final:" marker. Category: data. Use: .component(id, components.fieldExtractor({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the source value.
intostringyesChannel receiving the extracted scalar.
pathstringnoOptional dotted path descended into the from value (else the whole value).
finalOnlybooleannoWhen true, if the result is a string with a "final:" marker, keep only the text after the last marker (trimmed). Defaults to false.

bm25Retriever​

Lexical BM25 ranking of a corpus against a query; keep the top-k by score. Category: retrieval. Use: .component(id, components.bm25Retriever({...})).

ParameterTypeRequiredDescription
querystringyesChannel holding the query text (falls back to this literal when the channel is empty).
intostringyesChannel receiving the top-k { id, content, score } array.
knumbernoNumber of results to keep (default 4).
docsLexicalDoc[]yesThe corpus ({ id, content }[]) to rank.
k1numbernoBM25 term-frequency saturation. Defaults to 1.2.
bnumbernoBM25 length-normalization. Defaults to 0.75.

keywordRetriever​

Lexical keyword-overlap ranking: score each doc by the fraction of distinct query terms it contains. Category: retrieval. Use: .component(id, components.keywordRetriever({...})).

ParameterTypeRequiredDescription
querystringyesChannel holding the query text (falls back to this literal when the channel is empty).
intostringyesChannel receiving the top-k { id, content, score } array.
knumbernoNumber of results to keep (default 4).
docsLexicalDoc[]yesThe corpus ({ id, content }[]) to rank.

sentenceWindowSplitter​

Split text into overlapping windows of whole sentences (a sliding window with an explicit stride). Category: splitter. Use: .component(id, components.sentenceWindowSplitter({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the text to split.
intostringyesChannel receiving the string[] of sentence windows.
windowSizenumbernoSentences per window. Defaults to 3.
stridenumbernoSentences advanced between windows (1 <= stride <= windowSize). Defaults to 1.

languageDetector​

Heuristic language detection (en/fr/es/de/it/und) by stop-word hits, with an optional confidence score. Category: text. Use: .component(id, components.languageDetector({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the text to classify.
intostringyesChannel receiving the detected language code (or "und").
confidenceIntostringnoOptional channel receiving the winning language's share of hits in [0, 1].

metadataFilter​

Keep the items of an array channel whose dotted-path field satisfies a predicate. Category: data. Use: .component(id, components.metadataFilter({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the array to filter.
intostringyesChannel receiving the filtered array.
fieldstringyesDotted path into each item compared by the predicate.
op"equals" | "notEquals" | "contains" | "exists" | "absent" | "gt" | "gte" | "lt" | "lte"yesThe predicate operator.
valueunknownnoThe comparison value (required except for exists/absent).

listJoiner​

Combine several array channels into one list by concat, union (dedupe) or interleave. Category: data. Use: .component(id, components.listJoiner({...})).

ParameterTypeRequiredDescription
fromChannelsstring[]yesChannels whose array values are combined.
intostringyesChannel receiving the combined array.
mode"concat" | "union" | "interleave"noCombine mode. Defaults to "concat".

mergeRanker​

Fuse several retrieval-result streams into one ranking with Reciprocal Rank Fusion (RRF). Category: retrieval. Use: .component(id, components.mergeRanker({...})).

ParameterTypeRequiredDescription
fromChannelsstring[]yesChannels each holding a retrieval-result array to fuse.
intostringyesChannel receiving the fused { id, content, score } array.
idKeystringnoObject field identifying items across lists. Defaults to "id".
knumbernoKeep only the top-k fused results (default: keep all).
rrfKnumbernoReciprocal Rank Fusion constant. Defaults to 60.

evaluator​

Score actual vs expected text (token-F1 / set overlap / exact match), with an optional pass flag. Category: evaluation. Use: .component(id, components.evaluator({...})).

ParameterTypeRequiredDescription
expectedFromstringyesChannel holding the expected/reference text.
actualFromstringyesChannel holding the actual/candidate text.
intostringyesChannel receiving the numeric score in [0, 1].
metric"tokenF1" | "overlap" | "exact"noScoring metric. Defaults to "tokenF1".
passIntostringnoOptional channel receiving a boolean score >= threshold.
thresholdnumbernoPass threshold for passInto. Defaults to 0.5.

chatMessageBuilder​

Assemble a role-tagged chat-message array ([{ role, content }]) an LLM generator consumes. Category: generation. Use: .component(id, components.chatMessageBuilder({...})).

ParameterTypeRequiredDescription
intostringyesChannel receiving the [{ role, content }] array.
messagesChatMessageSpec[]yesOrdered specs ({ role, content?|contentFrom? }); content is rendered through the {{var}} template engine.
systemFromstringnoOptional channel prepended as a leading system message when non-empty.

conditionalRouter​

Multi-branch rule routing over the channels by dotted-path predicates (pairs with a conditional edge). Category: routing. Use: .component(id, components.conditionalRouter({...})).

ParameterTypeRequiredDescription
intostringyesChannel the chosen route string is written into.
defaultRoutestringyesRoute emitted when no branch matches.
branchesConditionalRouterBranch[]yesOrdered branches ({ when: { field, op, value? }, route }); the first match wins.

documentWriter​

Append documents into an in-state document store array (optionally de-duplicating by a field). Category: writer. Use: .component(id, components.documentWriter({...})).

ParameterTypeRequiredDescription
fromstringyesChannel holding the incoming documents array to append.
intostringyesChannel receiving the accumulated store array.
storestringnoChannel holding the current store. Defaults to into.
dedupeBystringnoOptional object field to de-duplicate the merged store by.

httpFetch​

Integration (vendor I/O): perform a real HTTP request via global fetch, writing { status, ok, body, json }. Never throws — non-2xx is surfaced via status/ok; an error/timeout writes { ok: false, error }. Category: integration. Use: .node(id, components.httpFetch({...})).

ParameterTypeRequiredDescription
urlstringnoA literal URL to fetch (mutually exclusive with urlFrom).
urlFromstringnoA channel whose value supplies the URL (takes precedence when its channel is set).
intostringyesChannel receiving the { status, ok, body, json } result.
methodstringnoHTTP method. Defaults to "GET".
headersRecord<string, string>noRequest headers sent with the call.
bodystringnoRequest body (sent verbatim) for non-GET methods.
timeoutMsnumbernoAbort the request after this many milliseconds (drives an AbortController).
fetchImplHttpFetchImplnoThe transport to call. Defaults to the real globalThis.fetch; inject a fake to stay offline.

webSearch​

Integration (vendor I/O): run a real web search (default: Tavily connector behind TAVILY_API_KEY), writing { results, note? }. Degrades gracefully with no network call (empty results + note) when the key is absent. Category: integration. Use: .node(id, components.webSearch({...})).

ParameterTypeRequiredDescription
querystringnoA literal query (mutually exclusive with queryFrom).
queryFromstringnoA channel whose value supplies the query (takes precedence when its channel is set).
intostringyesChannel receiving the { results, note? } outcome.
knumbernoNumber of results to request. Defaults to 3.
searchImplWebSearchImplnoThe search implementation to call. Defaults to a real Tavily connector behind TAVILY_API_KEY (no network when the key is absent).
transportWebSearchTransportnoHTTP transport the default Tavily connector posts through. Defaults to globalThis.fetch; inject a fake to stay offline. Ignored when searchImpl is supplied.