1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
//! # Paladin - Enterprise Multi-Agent Orchestration Framework
//!
//! Paladin is a Rust-based enterprise multi-agent orchestration framework built with
//! **Hexagonal Architecture** (Ports & Adapters) and **Domain-Driven Design** principles.
//! It enables the creation, coordination, and scaling of intelligent AI agents (Paladins)
//! through configurable orchestration patterns with comprehensive LLM integration.
//!
//! ## Core Concepts
//!
//! - **Paladin**: Autonomous AI agent capable of reasoning and action
//! - **Battalion**: Multi-agent coordination patterns (Formation, Phalanx, Campaign, Chain of Command)
//! - **Garrison**: Conversation memory and context storage
//! - **Arsenal**: External tool execution via MCP (Model Context Protocol)
//! - **Sanctum**: Vector storage for semantic search and RAG
//! - **Citadel**: State persistence and recovery
//!
//! ## Architecture
//!
//! The framework follows hexagonal architecture with three layers:
//!
//! - **Core Layer** (`core`): Pure business logic with zero external dependencies
//! - **Application Layer** (`application`): Use cases and port trait definitions
//! - **Infrastructure Layer** (`infrastructure`): Adapter implementations for external systems
//!
//! ## Stable Public API
//!
//! This library exports a **curated stable public API** defined in [STABLE_API.md](https://github.com/DF3NDR/paladin-dev-env/blob/main/STABLE_API.md).
//! The API follows **semantic versioning** with strong backwards compatibility guarantees:
//!
//! - **Port Traits**: Primary extension points for integrating external systems
//! - **Domain Entities**: Core business types (Paladin, Battalion, etc.)
//! - **Builders**: Fluent construction patterns
//! - **Configuration**: Application settings types
//! - **Errors**: Comprehensive error enums
//! - **Base Types**: Generic framework primitives
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use paladin::{PaladinBuilder, LlmPort};
//! use std::sync::Arc;
//!
//! # async fn example(llm_port: Arc<dyn LlmPort>) -> Result<(), Box<dyn std::error::Error>> {
//! // Create a Paladin agent
//! let paladin = PaladinBuilder::new(llm_port)
//! .name("ResearchAgent")
//! .system_prompt("You are a helpful research assistant.")
//! .max_loops(5)
//! .build()?;
//!
//! // Execute the agent
//! let result = paladin_service.execute(&paladin, "Analyze the market trends").await?;
//! println!("Response: {}", result.output);
//! # Ok(())
//! # }
//! ```
//!
//! ## Feature Flags
//!
//! - `redis-queue` (default): Redis-based async queue support
//! - `s3-storage` (default): MinIO/S3 file storage support
//! - `mysql-backend`: MySQL database backend
//! - `sqlite-backend`: SQLite database backend
//!
//! ## Documentation
//!
//! - [API Reference](https://docs.rs/paladin)
//! - [User Guides](https://github.com/DF3NDR/paladin-dev-env/tree/main/docs)
//! - [Examples](https://github.com/DF3NDR/paladin-dev-env/tree/main/examples)
//! - [Stable API Contract](https://github.com/DF3NDR/paladin-dev-env/blob/main/STABLE_API.md)
//!
//! ## Stability Guarantee
//!
//! All types exported from this module are part of the stable public API and follow
//! semantic versioning. Breaking changes will only occur in major version bumps.
//! See [STABLE_API.md](https://github.com/DF3NDR/paladin-dev-env/blob/main/STABLE_API.md) for details.
// ============================================================================
// Module Declarations
// ============================================================================
//
// Modules are public to support tests, examples, and advanced use cases,
// but the **curated exports below** define the stable public API.
// Users should prefer the root-level re-exports over direct module access.
/// Application layer: Use cases and port trait definitions
/// Configuration management
/// Core domain layer: Pure business logic
/// Infrastructure layer: Adapter implementations
/// Prelude: convenient re-exports of the most commonly used types.
// ============================================================================
// CLI Module (Internal/Testing Support)
// ============================================================================
//
// Re-export CLI module for testing and internal tooling.
// Only available when the `cli` feature is enabled.
// This is NOT part of the stable public API.
/// CLI module for internal tooling (not part of stable API).
/// Requires the `cli` feature flag.
pub use cli;
// ============================================================================
// Port Traits - Primary Stable API
// ============================================================================
// Output Ports (External System Integration)
pub use ;
// LLM adapter implementations (from paladin-llm crate)
pub use LlmProviderError;
pub use LlmProviderFactory;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// Re-export PromptItem from core for LLM usage
pub use PromptItem;
pub use ;
pub use ;
// Re-export SanctumEntry from core for Sanctum usage
pub use SanctumEntry;
// Memory Adapters (re-exported from paladin-memory)
pub use InMemoryGarrison;
pub use SqliteGarrison;
pub use InMemorySanctum;
pub use QdrantSanctumAdapter;
pub use ;
pub use ;
pub use ;
// Re-export ArsenalError from core for Arsenal usage
pub use ArsenalError;
pub use CitadelPort;
// Re-export CitadelError from application errors
pub use CitadelError;
pub use QueuePort;
// Re-export QueueError from application layer orchestrator
pub use QueueError;
pub use ;
pub use ;
pub use ;
pub use BattalionPort;
// Re-export Battalion types from core
pub use ;
/// Re-export of the `paladin-battalion` crate for convenience.
pub use paladin_battalion;
// Input Ports (Use Case Interfaces)
pub use ContentIngestionPort;
pub use DocumentPort;
pub use MlPort;
// ============================================================================
// Domain Entities
// ============================================================================
// Paladin (Agent) Types
pub use ;
pub use PaladinConfig;
// Battalion (Multi-Agent) Types
pub use ;
pub use Campaign;
pub use ChainOfCommand;
pub use Formation;
pub use Phalanx;
// Memory (Garrison) Types - Not exported as domain entities yet, use ports
// Tool (Arsenal) Types
pub use ;
// State (Citadel) Types - Not exported as domain entities yet, use ports
// ============================================================================
// Builder Types
// ============================================================================
pub use CommanderBuilder;
pub use PaladinBuilder;
pub use CouncilBuilder;
pub use GroveBuilder;
// ============================================================================
// Configuration Types
// ============================================================================
// Configuration types are currently not exported as stable API
// Users should use builder patterns and port traits instead
// ============================================================================
// Error Types
// ============================================================================
pub use CitadelError as CitadelServiceError;
pub use PaladinError;
// ============================================================================
// Base Types (Framework Primitives)
// ============================================================================
pub use CollectionType;
pub use Field;
pub use Message;
pub use Node;