build_flow
Compile and validate a flow's component graph, detecting configuration errors. Returns a job ID for asynchronous status monitoring.
Instructions
Compile and validate a flow, returning job ID for asynchronous status monitoring.
Purpose: Build and validate a flow's component graph, ensuring all nodes are properly configured and connected. Essential prerequisite for flow execution - detects configuration errors, validates component parameters, and prepares the flow for running. Returns job_id for tracking build progress asynchronously.
Parameters:
flow_id (required, UUID string): Flow identifier to build and validate
inputs (optional, object): Input values to use during build validation (key: input_name, value: test_data)
data (optional, object): Flow configuration override (use to build modified version without updating flow)
files (optional, array of strings): File paths to include in build context
stop_component_id (optional, string): Component ID where build should stop (useful for partial validation)
start_component_id (optional, string): Component ID where build should start (skip earlier components)
log_builds (optional, boolean, default: true): Enable detailed build logging for debugging
flow_name (optional, string): Override flow name during build (doesn't affect saved flow)
event_delivery (optional, string, default: "polling"): Delivery mode - "polling" (recommended), "streaming", or "direct"
Returns: BuildFlowResponse object containing:
job_id (UUID): Unique build job identifier for status polling via get_build_status
Usage Examples:
Basic build: { flow_id: "550e8400-e29b-41d4-a716-446655440000" }
Build with logging: { flow_id: "flow-uuid", log_builds: true }
Build with test inputs: { flow_id: "flow-uuid", inputs: { "user_message": "test" } }
Partial build: { flow_id: "flow-uuid", start_component_id: "node-1", stop_component_id: "node-5" }
Streaming events: { flow_id: "flow-uuid", event_delivery: "streaming" }
Best Practices:
Always build flow before first execution to catch configuration errors early
Use polling event_delivery for reliable status tracking in production
Enable log_builds during development for detailed error diagnostics
Rebuild after any flow modifications (nodes, edges, parameters)
Monitor build status with get_build_status using returned job_id
Use partial builds (start/stop component) for faster validation of specific sections
Validate inputs during build to ensure flow accepts expected data format
Cache successful build status to avoid unnecessary rebuilds
Common Errors:
"Flow not found": flow_id doesn't exist (verify with list_flows or get_flow)
"Invalid flow configuration": Flow has disconnected nodes or missing required parameters
"Component validation failed": Node configuration is invalid (check component settings in Langflow UI)
"Missing required component parameters": Required fields not set on components
"Build timeout": Complex flow took too long; simplify or optimize component chain
"Invalid component ID": start_component_id or stop_component_id doesn't exist in flow
"Circular dependency detected": Flow has loop in node connections
Related Tools:
get_build_status: Poll build completion and retrieve validation results using job_id
run_flow: Execute flow after successful build
get_flow: Inspect flow structure before building
cancel_build: Stop long-running build job
update_flow: Fix configuration errors found during build
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | Optional flow data/configuration | |
| files | No | Optional array of file paths | |
| inputs | No | Optional input values for the flow | |
| flow_id | Yes | Flow ID (UUID) to build | |
| flow_name | No | Optional flow name override | |
| log_builds | No | Whether to log build process (default: true) | |
| event_delivery | No | Event delivery mode: "polling", "streaming", or "direct" (default: "polling") | |
| stop_component_id | No | Optional component ID to stop at | |
| start_component_id | No | Optional component ID to start from |