Skip to main content

windmill_api/models/
flow_module_tool.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.775.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// FlowModuleTool : A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct FlowModuleTool {
17    #[serde(rename = "input_transforms")]
18    pub input_transforms: Box<models::AiAgentInputTransforms>,
19    /// The script source code. Should export a 'main' function
20    #[serde(rename = "content")]
21    pub content: String,
22    /// Programming language for this script
23    #[serde(rename = "language")]
24    pub language: Language,
25    /// Path to the flow in the workspace (e.g., 'f/flows/process_user')
26    #[serde(rename = "path")]
27    pub path: String,
28    /// Lock file content for dependencies
29    #[serde(rename = "lock", skip_serializing_if = "Option::is_none")]
30    pub lock: Option<String>,
31    #[serde(rename = "type")]
32    pub r#type: Type,
33    /// Worker group tag for execution routing. If not set, the AI agent step runs on the flow's tag (default `flow`)
34    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
35    pub tag: Option<String>,
36    /// Maximum concurrent executions of this script
37    #[serde(rename = "concurrent_limit", skip_serializing_if = "Option::is_none")]
38    pub concurrent_limit: Option<f64>,
39    /// Time window for concurrent_limit
40    #[serde(rename = "concurrency_time_window_s", skip_serializing_if = "Option::is_none")]
41    pub concurrency_time_window_s: Option<f64>,
42    /// Custom key for grouping concurrent executions
43    #[serde(rename = "custom_concurrency_key", skip_serializing_if = "Option::is_none")]
44    pub custom_concurrency_key: Option<String>,
45    /// If true, this script is a trigger that can start the flow
46    #[serde(rename = "is_trigger", skip_serializing_if = "Option::is_none")]
47    pub is_trigger: Option<bool>,
48    /// External resources this script accesses (S3 objects, resources, etc.)
49    #[serde(rename = "assets", skip_serializing_if = "Option::is_none")]
50    pub assets: Option<Vec<models::RawScriptAssetsInner>>,
51    /// Optional specific version hash of the script to use
52    #[serde(rename = "hash", skip_serializing_if = "Option::is_none")]
53    pub hash: Option<String>,
54    /// Override the script's default worker group tag
55    #[serde(rename = "tag_override", skip_serializing_if = "Option::is_none")]
56    pub tag_override: Option<String>,
57    /// Steps to execute in each iteration
58    #[serde(rename = "modules")]
59    pub modules: Vec<models::FlowModule>,
60    #[serde(rename = "iterator")]
61    pub iterator: Box<models::InputTransform>,
62    /// If true, iteration failures don't stop the loop. Failed iterations return null
63    #[serde(rename = "skip_failures")]
64    pub skip_failures: bool,
65    /// If true, the agent can execute multiple tool calls in parallel
66    #[serde(rename = "parallel", skip_serializing_if = "Option::is_none")]
67    pub parallel: Option<bool>,
68    #[serde(rename = "parallelism", skip_serializing_if = "Option::is_none")]
69    pub parallelism: Option<Box<models::InputTransform>>,
70    #[serde(rename = "squash", skip_serializing_if = "Option::is_none")]
71    pub squash: Option<bool>,
72    /// Array of branches that all execute (either in parallel or sequentially)
73    #[serde(rename = "branches")]
74    pub branches: Vec<models::BranchAllBranchesInner>,
75    /// Steps to execute if no branch expressions match
76    #[serde(rename = "default")]
77    pub default: Vec<models::FlowModule>,
78    /// If true, marks this as a flow identity (special handling)
79    #[serde(rename = "flow", skip_serializing_if = "Option::is_none")]
80    pub flow: Option<bool>,
81    /// Array of tools the agent can use. The agent decides which tools to call based on the task
82    #[serde(rename = "tools", skip_serializing_if = "Option::is_none")]
83    pub tools: Option<Vec<models::AgentTool>>,
84    /// If true, this AI agent step does not persist its assistant or tool messages to the flow conversation when chat mode is enabled.
85    #[serde(rename = "omit_output_from_conversation", skip_serializing_if = "Option::is_none")]
86    pub omit_output_from_conversation: Option<bool>,
87    /// Path of a reusable `ai_agent` resource (hybrid linking). When set, the agent brain config (provider/model/system prompt/etc.) and tool set are resolved at runtime from that resource; the module's input_transforms then only carry the flow-local inputs (user_message/user_attachments). 
88    #[serde(rename = "agent", skip_serializing_if = "Option::is_none")]
89    pub agent: Option<String>,
90    /// Host-local wiring for an agent's tool inputs, keyed by tool id then input key. Binds the referenced agent's tools to this flow's context (flow_input/results) without mutating the shared resource; overlaid onto the tools' input_transforms at runtime — including when `agent` is unset, since a step forked for editing keeps these overrides until it is saved back or unlinked. 
91    #[serde(rename = "tool_inputs", skip_serializing_if = "Option::is_none")]
92    pub tool_inputs: Option<std::collections::HashMap<String, std::collections::HashMap<String, models::InputTransform>>>,
93    #[serde(rename = "tool_type")]
94    pub tool_type: ToolType,
95}
96
97impl FlowModuleTool {
98    /// A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module
99    pub fn new(input_transforms: models::AiAgentInputTransforms, content: String, language: Language, path: String, r#type: Type, modules: Vec<models::FlowModule>, iterator: models::InputTransform, skip_failures: bool, branches: Vec<models::BranchAllBranchesInner>, default: Vec<models::FlowModule>, tool_type: ToolType) -> FlowModuleTool {
100        FlowModuleTool {
101            input_transforms: Box::new(input_transforms),
102            content,
103            language,
104            path,
105            lock: None,
106            r#type,
107            tag: None,
108            concurrent_limit: None,
109            concurrency_time_window_s: None,
110            custom_concurrency_key: None,
111            is_trigger: None,
112            assets: None,
113            hash: None,
114            tag_override: None,
115            modules,
116            iterator: Box::new(iterator),
117            skip_failures,
118            parallel: None,
119            parallelism: None,
120            squash: None,
121            branches,
122            default,
123            flow: None,
124            tools: None,
125            omit_output_from_conversation: None,
126            agent: None,
127            tool_inputs: None,
128            tool_type,
129        }
130    }
131}
132/// Programming language for this script
133#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
134pub enum Language {
135    #[serde(rename = "deno")]
136    Deno,
137    #[serde(rename = "bun")]
138    Bun,
139    #[serde(rename = "bunnative")]
140    Bunnative,
141    #[serde(rename = "python3")]
142    Python3,
143    #[serde(rename = "go")]
144    Go,
145    #[serde(rename = "bash")]
146    Bash,
147    #[serde(rename = "powershell")]
148    Powershell,
149    #[serde(rename = "postgresql")]
150    Postgresql,
151    #[serde(rename = "mysql")]
152    Mysql,
153    #[serde(rename = "bigquery")]
154    Bigquery,
155    #[serde(rename = "snowflake")]
156    Snowflake,
157    #[serde(rename = "mssql")]
158    Mssql,
159    #[serde(rename = "oracledb")]
160    Oracledb,
161    #[serde(rename = "graphql")]
162    Graphql,
163    #[serde(rename = "nativets")]
164    Nativets,
165    #[serde(rename = "php")]
166    Php,
167    #[serde(rename = "rust")]
168    Rust,
169    #[serde(rename = "ansible")]
170    Ansible,
171    #[serde(rename = "csharp")]
172    Csharp,
173    #[serde(rename = "nu")]
174    Nu,
175    #[serde(rename = "java")]
176    Java,
177    #[serde(rename = "ruby")]
178    Ruby,
179    #[serde(rename = "rlang")]
180    Rlang,
181    #[serde(rename = "duckdb")]
182    Duckdb,
183}
184
185impl Default for Language {
186    fn default() -> Language {
187        Self::Deno
188    }
189}
190/// 
191#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
192pub enum Type {
193    #[serde(rename = "aiagent")]
194    Aiagent,
195}
196
197impl Default for Type {
198    fn default() -> Type {
199        Self::Aiagent
200    }
201}
202/// 
203#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
204pub enum ToolType {
205    #[serde(rename = "flowmodule")]
206    Flowmodule,
207}
208
209impl Default for ToolType {
210    fn default() -> ToolType {
211        Self::Flowmodule
212    }
213}
214