Subgraph Data Enrichment
Subworkflows: calling one workflow from another with a workflow node.
scrapeaiworkflow
Source
/**
* Demonstrates the subworkflow pattern. A helper workflow enriches company
* data, and the main workflow calls it with a workflow node.
*/
webhook company_data {
label: "Company Data"
schema: @json {
{
"type": "object",
"required": ["company_name", "domain"],
"properties": {
"company_name": { "type": "string" },
"domain": { "type": "string" }
}
}
}
}
workflow enrich_company {
label: "Enrich Company Data"
root {
type: code
label: "Receive company"
code: @ts { return context.nodes.root.input }
outputSchema: @json {
{
"type": "object",
"properties": {
"company_name": { "type": "string" },
"domain": { "type": "string" }
}
}
}
}
node scrape_site {
type: scrape
label: "Scrape company site"
url: @ts { return "https://" + context.nodes.root.output.domain }
onlyMainContent: true
formats: ["markdown"]
}
node extract_info {
type: ai
label: "Extract company info"
kind: object
model: "google/gemini-2.5-flash"
prompt: @ts {
return "Extract company information from this website content.\n\nCompany: " + context.nodes.root.output.company_name + "\n\n" + JSON.stringify(context.nodes.scrape_site.output)
}
schema: @json {
{
"type": "object",
"required": ["description", "industry"],
"properties": {
"description": { "type": "string" },
"industry": { "type": "string" },
"employee_count_estimate": { "type": "string" },
"products": { "type": "array", "items": { "type": "string" } },
"technologies": { "type": "array", "items": { "type": "string" } }
}
}
}
}
flow {
root -> scrape_site
scrape_site -> extract_info
}
}
workflow process_company {
label: "Process Company"
root {
type: code
label: "Extract input"
code: @ts { return context.nodes.root.input }
outputSchema: @json {
{
"type": "object",
"properties": {
"company_name": { "type": "string" },
"domain": { "type": "string" }
}
}
}
}
node enrich {
type: workflow
label: "Enrich company"
workflow: enrich_company
input: @ts {
return {
company_name: context.nodes.root.output.company_name,
domain: context.nodes.root.output.domain
}
}
}
node combine {
type: code
label: "Combine results"
code: @ts {
const original = context.nodes.root.output
// A workflow node's output is keyed by the child workflow's leaf node
// name -- extract_info is the leaf of enrich_company.
const enriched = context.nodes.enrich.output.extract_info
return {
company_name: original.company_name,
domain: original.domain,
description: enriched.description,
industry: enriched.industry,
products: enriched.products || [],
technologies: enriched.technologies || []
}
}
}
flow {
root -> enrich
enrich -> combine
}
}
trigger on_company {
webhook:company_data -> process_company
enabled: true
}
Flow
Trigger to workflow
company_datawebhook
process_company
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Workflow nodes
CODE
Code Node
Receive company
SCRAPE
Scrape Node
Scrape company site
AI
AI Node
Extract company info
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.