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.879.0
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::AiDecisionInputTransforms>,
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 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    /// What a run of this step does when its concurrency limit is reached. `queue` (default) re-queues it to a later slot, `fail` ends it immediately as failed.
43    #[serde(rename = "on_concurrency_limit", skip_serializing_if = "Option::is_none")]
44    pub on_concurrency_limit: Option<OnConcurrencyLimit>,
45    /// Custom key for grouping concurrent executions
46    #[serde(rename = "custom_concurrency_key", skip_serializing_if = "Option::is_none")]
47    pub custom_concurrency_key: Option<String>,
48    /// If true, this script is a trigger that can start the flow
49    #[serde(rename = "is_trigger", skip_serializing_if = "Option::is_none")]
50    pub is_trigger: Option<bool>,
51    /// External resources this script accesses (S3 objects, resources, etc.)
52    #[serde(rename = "assets", skip_serializing_if = "Option::is_none")]
53    pub assets: Option<Vec<models::RawScriptAssetsInner>>,
54    /// Optional specific version hash of the script to use
55    #[serde(rename = "hash", skip_serializing_if = "Option::is_none")]
56    pub hash: Option<String>,
57    /// Override the script's default worker group tag
58    #[serde(rename = "tag_override", skip_serializing_if = "Option::is_none")]
59    pub tag_override: Option<String>,
60    /// Steps to execute in each iteration
61    #[serde(rename = "modules")]
62    pub modules: Vec<models::FlowModule>,
63    #[serde(rename = "iterator")]
64    pub iterator: Box<models::InputTransform>,
65    /// If true, iteration failures don't stop the loop. Failed iterations return null
66    #[serde(rename = "skip_failures")]
67    pub skip_failures: bool,
68    /// If true, the agent can execute multiple tool calls in parallel
69    #[serde(rename = "parallel", skip_serializing_if = "Option::is_none")]
70    pub parallel: Option<bool>,
71    #[serde(rename = "parallelism", skip_serializing_if = "Option::is_none")]
72    pub parallelism: Option<Box<models::InputTransform>>,
73    #[serde(rename = "squash", skip_serializing_if = "Option::is_none")]
74    pub squash: Option<bool>,
75    #[serde(rename = "iteration_label", skip_serializing_if = "Option::is_none")]
76    pub iteration_label: Option<Box<models::InputTransform>>,
77    /// Maximum number of iterations. Checked after each iteration; when reached and stop_after_if did not stop the loop, the loop fails with an error named 'LoopExhausted'
78    #[serde(rename = "max_iterations", skip_serializing_if = "Option::is_none")]
79    pub max_iterations: Option<i32>,
80    /// Maximum wall-clock seconds since the first iteration started, checked after each iteration. A running iteration is not interrupted, so the loop can exceed the limit by up to one iteration; the timeout of the body's steps caps an iteration. When reached and stop_after_if did not stop the loop, the loop fails with an error named 'LoopExhausted'
81    #[serde(rename = "max_duration_secs", skip_serializing_if = "Option::is_none")]
82    pub max_duration_secs: Option<i32>,
83    /// Array of branches that all execute (either in parallel or sequentially)
84    #[serde(rename = "branches")]
85    pub branches: Vec<models::BranchAllBranchesInner>,
86    /// Steps to execute if no branch expressions match
87    #[serde(rename = "default")]
88    pub default: Vec<models::FlowModule>,
89    /// If true, marks this as a flow identity (special handling)
90    #[serde(rename = "flow", skip_serializing_if = "Option::is_none")]
91    pub flow: Option<bool>,
92    /// Array of tools the agent can use. The agent decides which tools to call based on the task
93    #[serde(rename = "tools", skip_serializing_if = "Option::is_none")]
94    pub tools: Option<Vec<models::AgentTool>>,
95    /// If true, this AI agent step does not persist its assistant or tool messages to the flow conversation when chat mode is enabled.
96    #[serde(rename = "omit_output_from_conversation", skip_serializing_if = "Option::is_none")]
97    pub omit_output_from_conversation: Option<bool>,
98    /// 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, enabled_tools and the history inputs memory_id and previous_messages) and, optionally, the `model` and `reasoning_effort` overrides of what the agent saved. 
99    #[serde(rename = "agent", skip_serializing_if = "Option::is_none")]
100    pub agent: Option<String>,
101    /// 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. 
102    #[serde(rename = "tool_inputs", skip_serializing_if = "Option::is_none")]
103    pub tool_inputs: Option<std::collections::HashMap<String, std::collections::HashMap<String, models::InputTransform>>>,
104    #[serde(rename = "tool_type")]
105    pub tool_type: ToolType,
106}
107
108impl FlowModuleTool {
109    /// A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module
110    pub fn new(input_transforms: models::AiDecisionInputTransforms, 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 {
111        FlowModuleTool {
112            input_transforms: Box::new(input_transforms),
113            content,
114            language,
115            path,
116            lock: None,
117            r#type,
118            tag: None,
119            concurrent_limit: None,
120            concurrency_time_window_s: None,
121            on_concurrency_limit: None,
122            custom_concurrency_key: None,
123            is_trigger: None,
124            assets: None,
125            hash: None,
126            tag_override: None,
127            modules,
128            iterator: Box::new(iterator),
129            skip_failures,
130            parallel: None,
131            parallelism: None,
132            squash: None,
133            iteration_label: None,
134            max_iterations: None,
135            max_duration_secs: None,
136            branches,
137            default,
138            flow: None,
139            tools: None,
140            omit_output_from_conversation: None,
141            agent: None,
142            tool_inputs: None,
143            tool_type,
144        }
145    }
146}
147/// Programming language for this script
148#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
149pub enum Language {
150    #[serde(rename = "deno")]
151    Deno,
152    #[serde(rename = "bun")]
153    Bun,
154    #[serde(rename = "bunnative")]
155    Bunnative,
156    #[serde(rename = "python3")]
157    Python3,
158    #[serde(rename = "go")]
159    Go,
160    #[serde(rename = "bash")]
161    Bash,
162    #[serde(rename = "powershell")]
163    Powershell,
164    #[serde(rename = "postgresql")]
165    Postgresql,
166    #[serde(rename = "mysql")]
167    Mysql,
168    #[serde(rename = "bigquery")]
169    Bigquery,
170    #[serde(rename = "snowflake")]
171    Snowflake,
172    #[serde(rename = "mssql")]
173    Mssql,
174    #[serde(rename = "oracledb")]
175    Oracledb,
176    #[serde(rename = "graphql")]
177    Graphql,
178    #[serde(rename = "nativets")]
179    Nativets,
180    #[serde(rename = "php")]
181    Php,
182    #[serde(rename = "rust")]
183    Rust,
184    #[serde(rename = "ansible")]
185    Ansible,
186    #[serde(rename = "csharp")]
187    Csharp,
188    #[serde(rename = "nu")]
189    Nu,
190    #[serde(rename = "java")]
191    Java,
192    #[serde(rename = "ruby")]
193    Ruby,
194    #[serde(rename = "rlang")]
195    Rlang,
196    #[serde(rename = "duckdb")]
197    Duckdb,
198}
199
200impl Default for Language {
201    fn default() -> Language {
202        Self::Deno
203    }
204}
205/// 
206#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
207pub enum Type {
208    #[serde(rename = "aidecision")]
209    Aidecision,
210}
211
212impl Default for Type {
213    fn default() -> Type {
214        Self::Aidecision
215    }
216}
217/// What a run of this step does when its concurrency limit is reached. `queue` (default) re-queues it to a later slot, `fail` ends it immediately as failed.
218#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
219pub enum OnConcurrencyLimit {
220    #[serde(rename = "queue")]
221    Queue,
222    #[serde(rename = "fail")]
223    Fail,
224}
225
226impl Default for OnConcurrencyLimit {
227    fn default() -> OnConcurrencyLimit {
228        Self::Queue
229    }
230}
231/// 
232#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
233pub enum ToolType {
234    #[serde(rename = "flowmodule")]
235    Flowmodule,
236}
237
238impl Default for ToolType {
239    fn default() -> ToolType {
240        Self::Flowmodule
241    }
242}
243