Skip to main content

ironflow_core/
lib.rs

1//! # ironflow-core
2//!
3//! Core building blocks for the **ironflow** workflow engine. This crate
4//! provides composable, async operations that can be chained via plain Rust
5//! variables to build headless CI/CD, DevOps, and AI-powered workflows.
6//!
7//! # Operations
8//!
9//! | Operation | Description |
10//! |-----------|-------------|
11//! | [`Shell`](operations::shell::Shell) | Execute a shell command with timeout, env control, and `kill_on_drop`. |
12//! | [`Agent`](operations::agent::Agent) | Invoke an AI agent (Claude Code by default) with structured output support. |
13//! | [`Http`](operations::http::Http) | Perform HTTP requests via [`reqwest`] with builder-pattern ergonomics. |
14//!
15//! # Provider trait
16//!
17//! The [`AgentProvider`](provider::AgentProvider) trait abstracts the AI
18//! backend. The built-in [`ClaudeCodeProvider`](providers::claude::ClaudeCodeProvider)
19//! shells out to the `claude` CLI; swap it for
20//! [`RecordReplayProvider`](providers::record_replay::RecordReplayProvider)
21//! in tests for deterministic, zero-cost replay.
22//!
23//! # Quick start
24//!
25//! ```no_run
26//! use ironflow_core::prelude::*;
27//!
28//! # async fn example() -> Result<(), OperationError> {
29//! let files = Shell::new("ls -la").await?;
30//!
31//! let provider = ClaudeCodeProvider::new();
32//! let review = Agent::new()
33//!     .prompt(&format!("Summarise:\n{}", files.stdout()))
34//!     .model(Model::HAIKU)
35//!     .max_budget_usd(0.10)
36//!     .run(&provider)
37//!     .await?;
38//!
39//! println!("{}", review.text());
40//! # Ok(())
41//! # }
42//! ```
43
44pub mod dry_run;
45pub mod error;
46pub mod metric_names;
47pub mod parallel;
48pub mod provider;
49pub mod providers;
50pub mod retry;
51pub mod tracker;
52pub mod utils;
53
54/// Workflow operations (shell commands, agent calls, HTTP requests).
55pub mod operations {
56    pub mod agent;
57    pub mod http;
58    pub mod shell;
59}
60
61/// Re-exports of the most commonly used types.
62pub mod prelude {
63    pub use crate::dry_run::{DryRunGuard, is_dry_run, set_dry_run};
64    pub use crate::error::{AgentError, OperationError};
65    pub use crate::operations::agent::{Agent, AgentResult, Model, PermissionMode};
66    pub use crate::operations::http::{Http, HttpOutput};
67    pub use crate::operations::shell::{Shell, ShellOutput};
68    pub use crate::parallel::{try_join_all, try_join_all_limited};
69    pub use crate::provider::AgentProvider;
70    pub use crate::providers::claude::ClaudeCodeProvider;
71    pub use crate::providers::record_replay::RecordReplayProvider;
72    pub use crate::retry::RetryPolicy;
73    pub use crate::tracker::WorkflowTracker;
74    pub use schemars::JsonSchema;
75    pub use serde::{Deserialize, Serialize};
76}