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.754.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::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. Use stop_after_if to control when the loop ends
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")]
83    pub tools: 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    #[serde(rename = "tool_type")]
88    pub tool_type: ToolType,
89}
90
91impl FlowModuleTool {
92    /// A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module
93    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>, tools: Vec<models::AgentTool>, tool_type: ToolType) -> FlowModuleTool {
94        FlowModuleTool {
95            input_transforms: Box::new(input_transforms),
96            content,
97            language,
98            path,
99            lock: None,
100            r#type,
101            tag: None,
102            concurrent_limit: None,
103            concurrency_time_window_s: None,
104            custom_concurrency_key: None,
105            is_trigger: None,
106            assets: None,
107            hash: None,
108            tag_override: None,
109            modules,
110            iterator: Box::new(iterator),
111            skip_failures,
112            parallel: None,
113            parallelism: None,
114            squash: None,
115            branches,
116            default,
117            flow: None,
118            tools,
119            omit_output_from_conversation: None,
120            tool_type,
121        }
122    }
123}
124/// Programming language for this script
125#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
126pub enum Language {
127    #[serde(rename = "deno")]
128    Deno,
129    #[serde(rename = "bun")]
130    Bun,
131    #[serde(rename = "bunnative")]
132    Bunnative,
133    #[serde(rename = "python3")]
134    Python3,
135    #[serde(rename = "go")]
136    Go,
137    #[serde(rename = "bash")]
138    Bash,
139    #[serde(rename = "powershell")]
140    Powershell,
141    #[serde(rename = "postgresql")]
142    Postgresql,
143    #[serde(rename = "mysql")]
144    Mysql,
145    #[serde(rename = "bigquery")]
146    Bigquery,
147    #[serde(rename = "snowflake")]
148    Snowflake,
149    #[serde(rename = "mssql")]
150    Mssql,
151    #[serde(rename = "oracledb")]
152    Oracledb,
153    #[serde(rename = "graphql")]
154    Graphql,
155    #[serde(rename = "nativets")]
156    Nativets,
157    #[serde(rename = "php")]
158    Php,
159    #[serde(rename = "rust")]
160    Rust,
161    #[serde(rename = "ansible")]
162    Ansible,
163    #[serde(rename = "csharp")]
164    Csharp,
165    #[serde(rename = "nu")]
166    Nu,
167    #[serde(rename = "java")]
168    Java,
169    #[serde(rename = "ruby")]
170    Ruby,
171    #[serde(rename = "rlang")]
172    Rlang,
173    #[serde(rename = "duckdb")]
174    Duckdb,
175}
176
177impl Default for Language {
178    fn default() -> Language {
179        Self::Deno
180    }
181}
182/// 
183#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
184pub enum Type {
185    #[serde(rename = "aiagent")]
186    Aiagent,
187}
188
189impl Default for Type {
190    fn default() -> Type {
191        Self::Aiagent
192    }
193}
194/// 
195#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
196pub enum ToolType {
197    #[serde(rename = "flowmodule")]
198    Flowmodule,
199}
200
201impl Default for ToolType {
202    fn default() -> ToolType {
203        Self::Flowmodule
204    }
205}
206