Skip to main content

AgentStepConfig

Struct AgentStepConfig 

Source
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: String

The 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

Source

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");
Source

pub fn system_prompt(self, prompt: &str) -> Self

Set the system prompt.

Source

pub fn model(self, model: &str) -> Self

Set the model name.

Source

pub fn max_budget_usd(self, budget: f64) -> Self

Set the maximum budget in USD.

Source

pub fn max_turns(self, turns: u32) -> Self

Set the maximum number of turns.

Source

pub fn allow_tool(self, tool: &str) -> Self

Add an allowed tool.

Source

pub fn working_dir(self, dir: &str) -> Self

Set the working directory.

Source

pub fn permission_mode(self, mode: &str) -> Self

Set the permission mode.

Source

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());
Source

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

Source§

fn clone(&self) -> AgentStepConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentStepConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AgentStepConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AgentStepConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,