Skip to main content

stepflow_client/
lib.rs

1// Copyright 2025 DataStax Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4// in compliance with the License. You may obtain a copy of the License at
5//
6//     http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software distributed under the License
9// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10// or implied. See the License for the specific language governing permissions and limitations under
11// the License.
12
13//! # stepflow-client
14//!
15//! Rust client SDK for the [Stepflow](https://stepflow.org) orchestrator.
16//!
17//! Provides two main capabilities:
18//!
19//! - **Flow authoring** — build [`Flow`] definitions programmatically using
20//!   [`FlowBuilder`] and [`ValueExpr`]
21//! - **Orchestrator client** — store flows, submit runs, and monitor results via
22//!   [`StepflowClient`]
23//!
24//! # Example: store and run a flow
25//!
26//! ```rust,no_run
27//! use stepflow_client::{StepflowClient, FlowBuilder, ValueExpr};
28//!
29//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
30//! let mut client = StepflowClient::connect("http://localhost:7840").await?;
31//!
32//! let mut builder = FlowBuilder::new();
33//! builder.add_step(
34//!     "process",
35//!     "/python/my_func",
36//!     ValueExpr::object(vec![("data".to_string(), ValueExpr::workflow_input(Default::default()))]),
37//! );
38//! let flow = builder
39//!     .output(ValueExpr::step_output("process"))
40//!     .build()?;
41//!
42//! let flow_id = client.store_flow(&flow).await?;
43//! let output = client.run(&flow_id, serde_json::json!({"key": "value"})).await?;
44//! println!("{output}");
45//! # Ok(())
46//! # }
47//! ```
48
49pub mod client;
50pub mod error;
51pub mod flow;
52#[cfg(feature = "local-server")]
53pub mod local_server;
54
55pub use client::{
56    ComponentInfo, FlowVariable, ListComponentsResult, RunStatus, StatusEventStream, StepflowClient,
57};
58pub use error::{BuilderError, ClientError};
59pub use flow::{Flow, FlowBuilder, Step, ValueExpr};
60
61// Re-export stepflow-flow so users can access all types.
62pub use stepflow_flow;
63
64// Re-export StatusEvent so callers don't need to depend on stepflow-proto directly.
65pub use stepflow_proto::StatusEvent;