Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:FlowiseAI Flowise GenerateAgentflow

From Leeroopedia
Revision as of 11:15, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/FlowiseAI_Flowise_GenerateAgentflow.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Property Value
Page ID FlowiseAI_Flowise_GenerateAgentflow
Source Repository FlowiseAI/Flowise
Source File packages/ui/src/api/chatflows.js
Domain AI-Assisted Code Generation, Natural Language Processing, Visual Workflow Orchestration
Last Updated 2026-02-12 14:00 GMT

Overview

Implementation of the AI-powered agent flow generation API function that sends a natural language description to the server and receives a complete flow definition in return. This function wraps an HTTP POST request to the agentflow V2 generator endpoint.

Code Reference

Source Location

Signature

const generateAgentflow = (body) => client.post('/agentflowv2-generator/generate', body)

Import

import chatflowsApi from '@/api/chatflows'

Then invoke as:

chatflowsApi.generateAgentflow(body)

I/O Contract

Inputs

Parameter Type Required Description
body object Yes The request body containing the generation parameters.
body.question string Yes Natural language description of the desired agent workflow (e.g., "An agent that can autonomously search the web and generate report").
body.selectedChatModel string No Identifier of the chat model component to use for generation.
body.credentialId string No Credential ID to authenticate with the selected chat model provider.

Outputs

Field Type Description
data GeneratedFlow The generated flow definition containing nodes, edges, and configuration data suitable for loading into a ReactFlow canvas.

The function returns a Promise that resolves to an Axios response object. The generated flow payload is accessible via response.data.

Usage Examples

Basic flow generation

import chatflowsApi from '@/api/chatflows'

// Generate an agent flow from a natural language description
const response = await chatflowsApi.generateAgentflow({
    question: 'An agent that can autonomously search the web and generate report'
})
const generatedFlow = response.data

Generation with specific model and credentials

import chatflowsApi from '@/api/chatflows'

// Generate using a specific chat model and credential
const response = await chatflowsApi.generateAgentflow({
    question: 'A team of agents that can handle all customer queries',
    selectedChatModel: 'chatOpenAI',
    credentialId: 'cred-abc123'
})
const generatedFlow = response.data

UI Component

The primary UI for this feature is the AgentflowGeneratorDialog component:

  • File: packages/ui/src/ui-component/dialog/AgentflowGeneratorDialog.jsx (466 lines)
  • Key features:
    • Provides a dialog with a text input for the natural language description
    • Displays default instruction examples to guide users (e.g., "An agent that can autonomously search the web and generate report", "Summarize a document")
    • Includes a dropdown for selecting the chat model to use for generation
    • Shows a linear progress indicator during generation
    • On successful generation, passes the generated flow to the canvas via the onConfirm callback
import { flowContext } from '@/store/context/ReactFlowContext'

const AgentflowGeneratorDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
    const [customAssistantInstruction, setCustomAssistantInstruction] = useState('')
    const [loading, setLoading] = useState(false)
    const [progress, setProgress] = useState(0)
    const [selectedChatModel, setSelectedChatModel] = useState({})
    const { reactFlowInstance } = useContext(flowContext)
    // ...
}

API Client Configuration

The client import references the Axios API client configured at packages/ui/src/api/client.js. The full request URL resolves to {baseURL}/api/v1/agentflowv2-generator/generate.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment