pub struct AgentStepConfig {
pub prompt: String,
pub system_prompt: Option<String>,
pub model: Option<String>,
pub max_budget_usd: Option<f64>,
pub max_turns: Option<u32>,
pub allowed_tools: Vec<String>,
pub working_dir: Option<String>,
pub permission_mode: Option<String>,
pub output_schema: Option<String>,
}Expand description
Serializable configuration for an agent step.
§Examples
use ironflow_engine::config::AgentStepConfig;
let config = AgentStepConfig::new("Review this code for security issues")
.model("haiku")
.max_budget_usd(0.10);Fields§
§prompt: StringThe user prompt.
system_prompt: Option<String>Optional system prompt.
model: Option<String>Model name (e.g. “sonnet”, “opus”, “haiku”).
max_budget_usd: Option<f64>Maximum budget in USD.
max_turns: Option<u32>Maximum number of agentic turns.
allowed_tools: Vec<String>Tool allowlist.
working_dir: Option<String>Working directory for the agent.
permission_mode: Option<String>Permission mode (e.g. “auto”, “dont_ask”).
output_schema: Option<String>Optional JSON Schema string for structured output.
When set, the agent provider will request typed output conforming to this schema. The result value is guaranteed to be valid JSON matching the schema.
Implementations§
Source§impl AgentStepConfig
impl AgentStepConfig
Sourcepub fn new(prompt: &str) -> Self
pub fn new(prompt: &str) -> Self
Create a new agent config with the given prompt.
§Examples
use ironflow_engine::config::AgentStepConfig;
let config = AgentStepConfig::new("Summarize this file");
assert_eq!(config.prompt, "Summarize this file");Sourcepub fn system_prompt(self, prompt: &str) -> Self
pub fn system_prompt(self, prompt: &str) -> Self
Set the system prompt.
Sourcepub fn max_budget_usd(self, budget: f64) -> Self
pub fn max_budget_usd(self, budget: f64) -> Self
Set the maximum budget in USD.
Sourcepub fn allow_tool(self, tool: &str) -> Self
pub fn allow_tool(self, tool: &str) -> Self
Add an allowed tool.
Sourcepub fn working_dir(self, dir: &str) -> Self
pub fn working_dir(self, dir: &str) -> Self
Set the working directory.
Sourcepub fn permission_mode(self, mode: &str) -> Self
pub fn permission_mode(self, mode: &str) -> Self
Set the permission mode.
Sourcepub fn output<T: JsonSchema>(self) -> Self
pub fn output<T: JsonSchema>(self) -> Self
Set structured output from a Rust type implementing JsonSchema.
The schema is serialized once at build time. When set, the agent provider will request typed output conforming to this schema.
Important: structured output requires max_turns >= 2. The Claude CLI
uses the first turn for reasoning and a second turn to produce the
schema-conforming JSON. If max_turns is set to 1, the agent will
fail at runtime with an error_max_turns error.
§Examples
use ironflow_engine::config::AgentStepConfig;
use schemars::JsonSchema;
use serde::Deserialize;
#[derive(Deserialize, JsonSchema)]
struct Labels {
labels: Vec<String>,
}
let config = AgentStepConfig::new("Classify this email")
.output::<Labels>()
.max_turns(2);
assert!(config.output_schema.is_some());Sourcepub fn output_schema_raw(self, schema: String) -> Self
pub fn output_schema_raw(self, schema: String) -> Self
Set structured output from a pre-serialized JSON Schema string.
Use this when the schema comes from configuration (e.g. YAML/JSON files)
rather than a Rust type. For type-safe schema generation, prefer
output.
Important: structured output requires max_turns >= 2. See
output for details.
§Examples
use ironflow_engine::config::AgentStepConfig;
let schema = r#"{"type":"object","properties":{"score":{"type":"integer"}}}"#;
let config = AgentStepConfig::new("Rate this PR")
.output_schema_raw(schema.to_string());
assert_eq!(config.output_schema.as_deref(), Some(schema));Trait Implementations§
Source§impl Clone for AgentStepConfig
impl Clone for AgentStepConfig
Source§fn clone(&self) -> AgentStepConfig
fn clone(&self) -> AgentStepConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more