runtara_workflow_stdlib/lib.rs
1// Copyright (C) 2025 SyncMyOrders Sp. z o.o.
2// SPDX-License-Identifier: AGPL-3.0-or-later
3//! Runtara Workflow Standard Library
4//!
5//! Unified library for workflow binaries. Combines agents and runtime
6//! into a single crate that workflows link against.
7//!
8//! This library integrates with runtara-core via runtara-sdk for:
9//! - Instance registration and lifecycle management
10//! - Checkpointing for crash recovery
11//! - Signal handling (pause, cancel, resume)
12//! - Heartbeat/tick for liveness monitoring
13//!
14//! Usage in generated workflow code:
15//! ```rust
16//! extern crate runtara_workflow_stdlib;
17//! use runtara_workflow_stdlib::prelude::*;
18//! use runtara_workflow_stdlib::agents::*;
19//! ```
20
21// Re-export the agents crate
22pub use runtara_agents as agents;
23
24// Runtime module (wraps runtara-sdk)
25pub mod runtime;
26
27// Connection management (fetches connections from external service)
28pub mod connections;
29
30// Instance output handling (for Environment communication)
31pub mod instance_output;
32
33// Re-export serde at top level
34pub use serde;
35pub use serde_json;
36
37// Re-export libc for stderr redirection in generated workflows
38pub use libc;
39
40// Re-export tokio for async runtime in generated workflows
41pub use tokio;
42
43// Re-export runtara-sdk for direct use
44pub use runtara_sdk;
45
46// Prelude for convenient imports
47pub mod prelude {
48 // Runtime types
49 pub use crate::runtime::{Error, Result, RuntimeContext};
50
51 // SDK types for durability
52 pub use crate::runtime::{RuntaraSdk, SdkConfig, durable, register_sdk, sdk};
53
54 // Connection types
55 pub use crate::connections::{
56 ConnectionError, ConnectionResponse, RateLimitState, fetch_connection,
57 };
58
59 // Instance output types (for Environment communication)
60 pub use crate::instance_output::{
61 InstanceOutput, InstanceOutputStatus, write_cancelled, write_completed, write_failed,
62 write_sleeping, write_suspended,
63 };
64
65 // Serde types
66 pub use serde::{Deserialize, Serialize};
67 pub use serde_json;
68
69 // Agent registry
70 pub use runtara_agents::registry;
71}
72
73// Direct access to commonly used modules
74pub use runtara_agents::registry;
75pub use runtime::{Error, Result, RuntimeContext};