Skip to main content

dasein_agentic_sandbox/
lib.rs

1//! # agentic-sandbox
2//!
3//! Sandboxed code execution for the Agentic Framework.
4//!
5//! Provides isolated environments to safely execute LLM-generated code.
6//!
7//! ## Features
8//!
9//! - `process` (default) - Local process execution (for development)
10//! - `docker` - Docker container isolation (for production)
11//! - `remote` - Remote Firecracker server (legacy API)
12//! - `gateway` - Agentic Gateway integration (recommended for Firecracker)
13//!
14//! ## Example
15//!
16//! ```rust,no_run
17//! use agentic_sandbox::{Sandbox, ProcessSandbox};
18//!
19//! #[tokio::main]
20//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
21//!     let sandbox = ProcessSandbox::new();
22//!
23//!     let result = sandbox.execute("echo 'Hello, World!'").await?;
24//!     println!("Output: {}", result.stdout);
25//!
26//!     Ok(())
27//! }
28//! ```
29//!
30//! ## Gateway Sandbox (recommended for Firecracker)
31//!
32//! ```rust,ignore
33//! use agentic_sandbox::{Sandbox, GatewaySandbox};
34//!
35//! #[tokio::main]
36//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
37//!     let sandbox = GatewaySandbox::builder("http://gateway:8080")
38//!         .runtime("python")
39//!         .build()
40//!         .await?;
41//!
42//!     let result = sandbox.execute("print('Hello from Firecracker!')").await?;
43//!     println!("Output: {}", result.stdout);
44//!
45//!     Ok(())
46//! }
47//! ```
48
49mod error;
50mod traits;
51
52#[cfg(feature = "process")]
53mod process;
54
55#[cfg(feature = "docker")]
56mod docker;
57
58#[cfg(feature = "remote")]
59mod remote;
60
61#[cfg(feature = "gateway")]
62mod gateway;
63
64mod firecracker;
65
66pub use error::SandboxError;
67pub use traits::{ExecutionResult, Sandbox, SandboxArtifact};
68
69#[cfg(feature = "process")]
70pub use process::ProcessSandbox;
71
72#[cfg(feature = "docker")]
73pub use docker::DockerSandbox;
74
75#[cfg(feature = "remote")]
76pub use remote::{
77    ExecuteRequest, ExecuteResponse, RemoteSandbox, RemoteSandboxBuilder, RemoteSandboxConfig,
78};
79
80#[cfg(feature = "gateway")]
81pub use gateway::{
82    GatewayHealthResponse, GatewaySandbox, GatewaySandboxBuilder, GatewaySandboxConfig, Runtime,
83};
84
85pub use firecracker::{FirecrackerConfig, FirecrackerSandbox, FirecrackerSandboxBuilder};