Skip to main content

Windmill AI

Windmill provides ways to have AI help you in your coding experience.

OpenAI integration

If you're rather interested in leveraging OpenAI from your scripts, flows and apps, check OpenAI Integration.

To enable Windmill AI, go to the "Windmill AI" tab in the workspace settings and add an OpenAI resource. Code completion is disabled by default, but you can enable it in the same tab.

Windmill AI uses OpenAI's GPT-4o.

Enable Windmill autopilot

Windmill AI for Scripts

Generate Windmill-specific code from simple text. All languages that can be run on Windmill are supported.

Code Generation


In a code editor (Script, Flow, Apps), click on AI and write a prompt describing what the script should do. The script will follow Windmill's main requirements and features (exposing a main function, importing libraries, using resource types, declaring required parameters with types). Moreover, when creating an SQL or GraphQL script, the AI assistant will take into account the database/GraphQL API schema when selected.

Prompt

Pro tips

The AI assistant is particularly effective when generating Python and TypeScript (Bun runtime) scripts, so we recommend using these languages when possible. Moreover, you will get better results if you specify in the prompt what the script should take as parameters, what it should return, the specific integration and libraries it should use if any. For instance, in the demo video above we wanted to generate a script that fetches the commits of a GitHub repository passed as a parameter, so we wrote: fetch and return the commits of a given repository on GitHub using octokit.

Code Editing

Inside the AI Gen popup, you can choose to edit the existing code rather than generating a new one. The assistant will modify the code according to your prompt.

Code Fixing

Upon error when executing code, you will be offered to "AI Fix" it. The assistant will automatically read the code, explain what went wrong, and suggest a way to fix it.

Summary Copilot

From your code, the AI assistant can generate a script summary.

Windmill AI for Flows

Generate Workflows from prompts.

Windmill AI for Flows support two creation modes: Sequence Flows and Trigger Flows. In both cases, you specify a prompt for each step. The AI assistant will then generate the code step by step and link them together. You will have the opportunity at the end of each step to review, edit or even regenerate the step's code.

For each action, you can either choose a script from the Hub or generate one from scratch using Windmill AI. At the end of the process, flow inputs are inferred and you just need to fill them in.

Sequence Flows

Generate a flow consisting of a sequence of scripts.

Trigger Flows

Trigger flows are designed to pull data from an external source and return all of the new items since the last run, without resorting to external webhooks. A trigger script is intended to be used as scheduled poll with schedules and states (rich objects in JSON, persistent from one run to another) in order to compare the execution to the previous one and process each new item in a for loop.

If there are no new items, the flow will be skipped.


The inputs of the for-loop action are automatically filled in with the outputs of the trigger step.

Moreover, the flow is automatically set to run every 15 minutes when deployed. The schedule can then be customized (e.g. every 30 seconds etc.). This allows you to avoid relying on webhooks sent by external APIs, which can be tedious to configure.

Summary Copilot for Steps

From your code, the AI assistant can generate a summary for flow steps.

Step Input Copilot

When adding a new step to a flow, the AI assistant will suggest inputs based on the previous steps' results and flow inputs.

Flow Loops Iterator Expressions from Context

When adding a for loop, the AI assistant will suggest iterator expressions based on the previous steps' results.

Flow Branches Predicate Expressions from Prompts

When adding a branch, the AI assistant will suggest predicate expressions from a prompt.

Azure OpenAI Advanced Models

You can run all Windmill AI features on a specified deployed model.

You need to specify the base path of the model in the instance settings.

Windmill AI Code Completion

When Code Completion is enabled, Windmill AI suggests completions as you type in all code editors (Script, Flow, Apps).

CRON Schedules from Prompt