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.592.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
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    #[serde(rename = "tool_type")]
85    pub tool_type: ToolType,
86}
87
88impl FlowModuleTool {
89    /// A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module
90    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 {
91        FlowModuleTool {
92            input_transforms: Box::new(input_transforms),
93            content,
94            language,
95            path,
96            lock: None,
97            r#type,
98            tag: None,
99            concurrent_limit: None,
100            concurrency_time_window_s: None,
101            custom_concurrency_key: None,
102            is_trigger: None,
103            assets: None,
104            hash: None,
105            tag_override: None,
106            modules,
107            iterator: Box::new(iterator),
108            skip_failures,
109            parallel: None,
110            parallelism: None,
111            squash: None,
112            branches,
113            default,
114            flow: None,
115            tools,
116            tool_type,
117        }
118    }
119}
120/// Programming language for this script
121#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
122pub enum Language {
123    #[serde(rename = "deno")]
124    Deno,
125    #[serde(rename = "bun")]
126    Bun,
127    #[serde(rename = "python3")]
128    Python3,
129    #[serde(rename = "go")]
130    Go,
131    #[serde(rename = "bash")]
132    Bash,
133    #[serde(rename = "powershell")]
134    Powershell,
135    #[serde(rename = "postgresql")]
136    Postgresql,
137    #[serde(rename = "mysql")]
138    Mysql,
139    #[serde(rename = "bigquery")]
140    Bigquery,
141    #[serde(rename = "snowflake")]
142    Snowflake,
143    #[serde(rename = "mssql")]
144    Mssql,
145    #[serde(rename = "oracledb")]
146    Oracledb,
147    #[serde(rename = "graphql")]
148    Graphql,
149    #[serde(rename = "nativets")]
150    Nativets,
151    #[serde(rename = "php")]
152    Php,
153}
154
155impl Default for Language {
156    fn default() -> Language {
157        Self::Deno
158    }
159}
160/// 
161#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
162pub enum Type {
163    #[serde(rename = "aiagent")]
164    Aiagent,
165}
166
167impl Default for Type {
168    fn default() -> Type {
169        Self::Aiagent
170    }
171}
172/// 
173#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
174pub enum ToolType {
175    #[serde(rename = "flowmodule")]
176    Flowmodule,
177}
178
179impl Default for ToolType {
180    fn default() -> ToolType {
181        Self::Flowmodule
182    }
183}
184