Entry point for all TopFlow workflows. Defines the initial input and triggers workflow execution. Every workflow must have exactly one Start node.
The Start Node is the beginning of every workflow. It:
string"" (empty string)"Analyze these security logs..."export type StartNodeData = {
// Configuration
input: string // Initial input data
// Execution state (managed by system)
status?: "idle" | "running" | "completed" | "error"
output?: any
error?: string
}Node Props:
import { NodeProps } from "@xyflow/react"
export function StartNode({ data, id }: NodeProps<StartNodeData>) {
// Component implementation
return (
<div className="start-node">
<Handle type="source" position={Position.Right} />
{/* Node UI */}
</div>
)
}const workflow = {
nodes: [
{
id: "start-1",
type: "start",
data: {
input: "Analyze threat intelligence for CVE-2026-1234"
}
},
{
id: "text-1",
type: "textModel",
data: {
model: "gpt-4",
prompt: "$input1" // Receives Start node output
}
}
],
edges: [
{ id: "e1", source: "start-1", target: "text-1" }
]
}Workflow configuration (input left empty):
{
id: "start-1",
type: "start",
data: {
input: "" // Empty - will be provided via API
}
}API execution:
const response = await fetch("/api/execute-workflow", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
workflow: { nodes, edges },
input: "Real-time security alert from SIEM", // Overrides Start node input
apiKeys: { openai: "sk-..." }
})
})const workflow = {
nodes: [
{
id: "start-1",
type: "start",
data: { input: "Security incident details" }
},
{
id: "classify-1",
type: "textModel",
data: { model: "gpt-4", prompt: "Classify severity: $input1" }
},
{
id: "extract-1",
type: "textModel",
data: { model: "gpt-4", prompt: "Extract IOCs from: $input1" }
}
],
edges: [
{ id: "e1", source: "start-1", target: "classify-1" },
{ id: "e2", source: "start-1", target: "extract-1" } // Same input to both
]
}Workflow must have exactly one Start node
Only one Start node allowed per workflow
Start node cannot have incoming edges (no inputs allowed)
Start node must connect to at least one downstream node
Start node has empty input. This is valid for API-triggered workflows but may cause issues in demo mode.
Workflow Function Export:
// Generated code for workflow function export
export async function runAgentWorkflow(
initialInput?: string // Start node input becomes parameter
) {
// Use initialInput or default from Start node configuration
const startInput = initialInput || "Analyze these security logs"
// Start node execution (returns input as-is)
const node_start = startInput
// Downstream nodes receive `node_start` as input
const node_textModel = await generateText({
model: openai("gpt-4"),
prompt: node_start // $input1 becomes node_start
})
return node_textModel.text
}Route Handler Export:
// Generated code for Next.js API route
export async function POST(req: Request) {
const { input } = await req.json()
// Start node input from API request
const node_start = input || "Default input"
const node_textModel = await generateText({
model: openai(process.env.OPENAI_API_KEY),
prompt: node_start
})
return Response.json({ output: node_textModel.text })
}Continue learning about other node types and workflow patterns: