Skip to main content

dasein_agentic_core/
lib.rs

1//! # agentic-core
2//!
3//! Core components for the Agentic Framework.
4//!
5//! This crate provides:
6//! - [`Agent`] - The autonomous entity that processes tasks
7//! - [`Supervisor`] - Orchestrates executors for distributed systems
8//! - [`Executor`] - Worker that processes tasks with LLM
9//! - [`Validator`] - Rule-based output validation (fast, heuristic)
10//! - [`SandboxValidator`] - Ground truth validation via real execution (for code)
11//! - Protocol types for inter-agent communication
12//!
13//! # Two Validation Strategies
14//!
15//! | Strategy | Use Case | How it Works |
16//! |----------|----------|--------------|
17//! | [`Validator`] | Text, JSON, quick checks | Rule-based heuristics |
18//! | [`SandboxValidator`] | Code generation | Real `cargo test` execution |
19//!
20//! ## Quick Start (Distributed Mode)
21//!
22//! ```rust,no_run
23//! use dasein_agentic_core::distributed::{Supervisor, Executor, Validator};
24//!
25//! #[tokio::main]
26//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
27//!     // Create a supervisor with 4 executors
28//!     let sup = Supervisor::new("sup-code")
29//!         .domain("code")
30//!         .executors(4)
31//!         .llm_gemini("gemini-2.0-flash")
32//!         .allow_lending(true)
33//!         .build_async()
34//!         .await;
35//!
36//!     println!("Pool size: {}", sup.pool_size().await);
37//!     println!("Idle: {}", sup.idle_count().await);
38//!
39//!     Ok(())
40//! }
41//! ```
42//!
43//! ## Even Simpler
44//!
45//! ```rust,no_run
46//! use dasein_agentic_core::distributed::Supervisor;
47//!
48//! // One-liner
49//! let config = Supervisor::quick("my-sup", 4).build();
50//! ```
51
52pub mod agent;
53pub mod distributed;
54pub mod error;
55pub mod patterns;
56pub mod prelude;
57pub mod protocol;
58pub mod types;
59
60pub use agent::Agent;
61pub use error::AgentError;
62pub use types::{
63    AgentConfig, AgentMetrics, AgentState, AgentStatus, Artifact, ArtifactType, ExecutionMode,
64    ResultMetrics, ResultPayload, ResultStatus, TaskPayload,
65};
66
67// Re-export distributed types for convenience
68pub use distributed::{
69    AllocationGrant, AllocationManager, AllocationRequest, Capability, Executor, ExecutorBuilder,
70    ExecutorPool, ExecutorState, LLMConfig, Language, PoolConfig, SandboxConfig,
71    SandboxValidationResult, SandboxValidator, Supervisor, SupervisorBuilder, SupervisorHandle,
72    ValidationAction, ValidationResult, ValidationRule, Validator, ValidatorBuilder,
73};