Skip to main content

orvanta_api/models/
flow_module_tool.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 6.5.0
7 * Contact: contact@orvanta.cloud
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    /// 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 = "bun")]
128    Bun,
129    #[serde(rename = "python3")]
130    Python3,
131    #[serde(rename = "go")]
132    Go,
133    #[serde(rename = "bash")]
134    Bash,
135    #[serde(rename = "postgresql")]
136    Postgresql,
137    #[serde(rename = "mysql")]
138    Mysql,
139    #[serde(rename = "bigquery")]
140    Bigquery,
141    #[serde(rename = "graphql")]
142    Graphql,
143    #[serde(rename = "nativets")]
144    Nativets,
145    #[serde(rename = "bunnative")]
146    Bunnative,
147    #[serde(rename = "php")]
148    Php,
149    #[serde(rename = "rust")]
150    Rust,
151    #[serde(rename = "java")]
152    Java,
153    #[serde(rename = "ruby")]
154    Ruby,
155    #[serde(rename = "duckdb")]
156    Duckdb,
157    #[serde(rename = "kotlin")]
158    Kotlin,
159    #[serde(rename = "dart")]
160    Dart,
161}
162
163impl Default for Language {
164    fn default() -> Language {
165        Self::Bun
166    }
167}
168/// 
169#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
170pub enum Type {
171    #[serde(rename = "aiagent")]
172    Aiagent,
173}
174
175impl Default for Type {
176    fn default() -> Type {
177        Self::Aiagent
178    }
179}
180/// 
181#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
182pub enum ToolType {
183    #[serde(rename = "flowmodule")]
184    Flowmodule,
185}
186
187impl Default for ToolType {
188    fn default() -> ToolType {
189        Self::Flowmodule
190    }
191}
192