paladin-ai 0.5.1

Enterprise AI orchestration framework with multi-agent coordination patterns
Documentation
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# Paladin Feature Flags

Paladin uses Cargo feature flags to enable fine-grained control over compiled dependencies and functionality. This allows you to build minimal, focused binaries for specific use cases while reducing compile times and binary sizes.

> See also the [Crate Map & Feature Flags]crate-map.md reference for per-crate flag tables, the crate dependency graph, and copy-paste consumer profiles.

## Table of Contents

- [Overview]#overview
- [Available Feature Flags]#available-feature-flags
- [Default Configuration]#default-configuration
- [Usage Examples]#usage-examples
- [Build Comparison]#build-comparison
- [Feature Dependencies]#feature-dependencies
- [Best Practices]#best-practices

## Overview

### Philosophy

Feature flags in Paladin follow these principles:

1. **Core Framework Always Available** - Paladin agents, Battalion orchestration, Garrison memory, Arsenal tools, and Herald formatters are always compiled
2. **Provider Choice** - Choose which LLM providers to support (OpenAI, Anthropic, DeepSeek)
3. **Subsystem Opt-In** - Enable only the subsystems you need (web servers, content processing, notifications)
4. **Infrastructure Selection** - Pick storage/queue adapters (Redis, S3/MinIO, Qdrant)
5. **Testing Flexibility** - Enable integration tests only when needed

### Default vs. Full

| Configuration | Features Enabled | Use Case |
|--------------|------------------|----------|
| **Default** | `llm-openai` only | Production orchestration with OpenAI |
| **Full** | All optional features | Development, testing, full functionality |
| **No Default** | Core framework only | Library usage, custom integrations |

## Available Feature Flags

### LLM Provider Flags

| Flag | Dependencies | Modules Gated | Description |
|------|--------------|---------------|-------------|
| `llm-openai` | None (uses `reqwest`) | `infrastructure::adapters::llm::openai_adapter` | OpenAI GPT models (GPT-3.5, GPT-4, GPT-4-turbo, GPT-4o) |
| `llm-anthropic` | None (uses `reqwest`) | `infrastructure::adapters::llm::anthropic_adapter` | Anthropic Claude models (Claude 3 Opus, Sonnet, Haiku) |
| `llm-deepseek` | None (uses `reqwest`) | `infrastructure::adapters::llm::deepseek_adapter` | DeepSeek models (DeepSeek-V3, DeepSeek-Chat) |
| `llm-all` | `llm-openai`, `llm-anthropic`, `llm-deepseek` | All LLM adapters | All supported LLM providers |

### Subsystem Flags

| Flag | Dependencies | Modules Gated | Description |
|------|--------------|---------------|-------------|
| `vision` | None | Vision-related types, prompt builders | Enable vision capabilities for multimodal LLM interactions |
| `content-processing` | `pdf-extract`, `scraper`, `tiktoken-rs`, `rss` | Content extraction, tokenization | PDF parsing, web scraping, RSS feeds, token counting |
| `web-server` | `actix-web`, `axum` | REST API controllers, server setup | HTTP/REST API servers for user management and content delivery |
| `notifications` | `lettre`, `handlebars` | Email adapter, templating | Email notifications with template rendering |

### Storage & Queue Flags

| Flag | Dependencies | Modules Gated | Description |
|------|--------------|---------------|-------------|
| `redis-queue` | `redis` | `infrastructure::adapters::queue::redis` | Redis-based async queue adapter |
| `s3-storage` | `rust-s3` | `infrastructure::adapters::file_storage::minio` | S3/MinIO file storage adapter |
| `openai-embeddings` | None | Embedding generation utilities | OpenAI embedding model support |
| `qdrant` | `qdrant-client` | Qdrant vector database adapter | Vector database for semantic search |
| `storage-sqlite` | `sqlx` (sqlite) | `paladin-storage` SQLite adapters | SQLite-based persistent repository |
| `storage-mysql` | `sqlx` (mysql) | `paladin-storage` MySQL adapters | MySQL-based persistent repository |
| `storage` | `storage-sqlite`, `storage-mysql` | Both storage adapters | Convenience flag enabling both DB backends |

### Special Build Flags

| Flag | Description |
|------|-------------|
| `vendored-openssl` | Statically compile OpenSSL from source. Used for cross-compiled release binaries that lack a target-arch system libssl. |

### CLI Flags

| Flag | Dependencies | Modules Gated | Description |
|------|--------------|---------------|-------------|
| `cli` | `clap`, `dialoguer`, `indicatif`, `console`, `serde_yaml` | `application::cli` | Command-line tooling for the `paladin-cli` binary |

Build the `paladin-cli` binary with:
```bash
cargo build --bin paladin-cli --features cli
```

### Testing Flags

| Flag | Dependencies | Modules Gated | Description |
|------|--------------|---------------|-------------|
| `integration-tests` | None | Integration test modules | Enable integration tests (Docker services required) |
| `live-api-tests` | None | Live API test modules | Tests requiring real API keys (OpenAI, Anthropic, DeepSeek) |

### Convenience Flags

| Flag | Enables | Description |
|------|---------|-------------|
| `full` | `llm-all`, `content-processing`, `web-server`, `notifications`, `vision`, `redis-queue`, `s3-storage`, `openai-embeddings`, `qdrant`, `cli` | All optional features for development/testing |

## Default Configuration

**Current Default** (as of v0.5.0):

```toml
[dependencies]
paladin-ai = "0.5"
```

This enables **only**:
- `llm-openai` - OpenAI LLM provider
- ✅ Core framework (always available)

**Previous Default** (before v0.5.0):

```toml
# Old default - no longer applies
default = ["redis-queue", "s3-storage", "openai-embeddings"]
```

See [migration-guide.md](migration-guide.md) for migration guidance.

## Usage Examples

### Minimal Build (Core Only)

No external LLM providers, storage, or queues:

```toml
[dependencies]
paladin-ai = { version = "0.5", default-features = false }
```

**Use case**: Custom LLM integrations, library embedding, edge deployments

### Single Provider Builds

**OpenAI Only** (default):
```toml
[dependencies]
paladin-ai = "0.5"
# Or explicitly:
paladin-ai = { version = "0.5", features = ["llm-openai"] }
```

**Anthropic Only**:
```toml
[dependencies]
paladin-ai = { version = "0.5", default-features = false, features = ["llm-anthropic"] }
```

**DeepSeek Only**:
```toml
[dependencies]
paladin-ai = { version = "0.5", default-features = false, features = ["llm-deepseek"] }
```

### Multi-Provider Builds

**All LLM Providers**:
```toml
[dependencies]
paladin-ai = { version = "0.5", default-features = false, features = ["llm-all"] }
```

**OpenAI + Anthropic**:
```toml
[dependencies]
paladin-ai = { version = "0.5", default-features = false, features = ["llm-openai", "llm-anthropic"] }
```

### Orchestration Platform Build

Agents + web API + Redis queue + S3 storage:

```toml
[dependencies]
paladin-ai = { version = "0.5", features = ["web-server", "redis-queue", "s3-storage"] }
```

### Content Processing Build

Content ingestion + processing + all providers:

```toml
[dependencies]
paladin-ai = { version = "0.5", features = ["llm-all", "content-processing", "qdrant", "s3-storage"] }
```

### Full Development Build

All features enabled:

```toml
[dependencies]
paladin-ai = { version = "0.5", features = ["full"] }
```

Or use the CLI:

```bash
cargo build --features full
cargo test --features full
```

### Production API Server

Web server + notifications + OpenAI + storage:

```toml
[dependencies]
paladin-ai = { version = "0.5", features = ["web-server", "notifications", "redis-queue", "s3-storage"] }
```

## Build Comparison

### Binary Size Comparison

| Configuration | Features | Dependencies | Approx. Binary Size* | Compile Time* |
|---------------|----------|--------------|---------------------|---------------|
| Core Only | None | ~50 crates | 8-12 MB | 30-45s |
| Default | `llm-openai` | ~55 crates | 10-14 MB | 40-60s |
| Full | All | ~120 crates | 25-35 MB | 3-5 min |

*Approximate values for release builds on x86_64 Linux. Actual values vary by system.

### Compile Time Optimization

**Fast iteration** (core only):
```bash
cargo build --no-default-features
cargo test --lib --no-default-features
```

**Full testing** (all features):
```bash
cargo test --features full
```

## Feature Dependencies

### Dependency Tree

```
full
├── llm-all
│   ├── llm-openai
│   ├── llm-anthropic
│   └── llm-deepseek
├── content-processing
│   ├── pdf-extract
│   ├── scraper
│   ├── tiktoken-rs
│   └── rss
├── web-server
│   ├── actix-web
│   └── axum
├── notifications
│   ├── lettre
│   └── handlebars
├── vision
├── redis-queue
│   └── redis
├── s3-storage
│   └── rust-s3
├── openai-embeddings
└── qdrant
    └── qdrant-client
```

### Conditional Compilation Examples

**In Your Code:**

```rust,ignore
// Always available (core framework)
use paladin::core::platform::container::paladin::Paladin;
use paladin::application::services::paladin::paladin_builder::PaladinBuilder;

// Conditionally compiled
#[cfg(feature = "llm-openai")]
use paladin::infrastructure::adapters::llm::openai_adapter::OpenAIAdapter;

#[cfg(feature = "redis-queue")]
use paladin::infrastructure::adapters::queue::redis::RedisQueueAdapter;

#[cfg(feature = "web-server")]
use paladin::infrastructure::web::server::start_web_server;
```

## Best Practices

### 1. Start Minimal, Add as Needed

Begin with default features, add others only when required:

```toml
# Start here
[dependencies]
paladin-ai = "0.5"

# Add features as needed
paladin-ai = { version = "0.5", features = ["redis-queue"] }
```

### 2. Use `full` for Development Only

Enable all features during development, but specify exact features for production:

```toml
[dependencies]
# Production - explicit features
paladin-ai = { version = "0.5", features = ["llm-anthropic", "s3-storage"] }

[dev-dependencies]
# Development - all features
paladin-ai = { version = "0.5", features = ["full"] }
```

### 3. Document Feature Requirements

If your application requires specific features, document them:

```rust,ignore
//! # Example Application
//!
//! **Required Features:**
//! ```toml
//! paladin-ai = { version = "0.5", features = ["llm-openai", "redis-queue", "s3-storage"] }
//! ```
```

### 4. Test with Multiple Feature Combinations

Use CI to test critical combinations:

```yaml
# .github/workflows/ci.yml
strategy:
  matrix:
    features:
      - "--no-default-features"
      - ""  # default
      - "--features full"
```

See [.github/workflows/](https://github.com/DF3NDR/paladin-dev-env/tree/main/.github/workflows) for Paladin's complete feature matrix testing.

### 5. Feature-Gate Examples

Add feature requirements to example documentation:

```rust,ignore
//! # Redis Queue Example
//!
//! **Required Cargo Features:**
//! ```toml
//! paladin-ai = { version = "0.5", features = ["redis-queue"] }
//! ```
//!
//! Run with: `cargo run --example redis_queue --features redis-queue`
```

## Migration Guide

If you're upgrading from a version before the feature flag reorganization, see [migration-guide.md](migration-guide.md) for detailed migration instructions.

## CI/CD Integration

### GitHub Actions

```yaml
name: CI
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        features:
          - ""                              # default
          - "--no-default-features"         # core only
          - "--features full"               # all features
          - "--features llm-anthropic"      # specific provider
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
      - name: Test
        run: cargo test ${{ matrix.features }}
```

### Docker Multi-Stage Builds

```dockerfile
# Builder with only needed features
FROM rust:1.75 as builder
WORKDIR /app
COPY . .
RUN cargo build --release --features "llm-openai,redis-queue,s3-storage"

# Runtime image
FROM debian:bookworm-slim
COPY --from=builder /app/target/release/paladin /usr/local/bin/
CMD ["paladin"]
```

## Support

For issues or questions about feature flags:
- **Documentation**: [Configuration Guide]../getting-started/configuration.md
- **Migration**: [Migration Guide]migration-guide.md
- **Issues**: [GitHub Issues]https://github.com/DF3NDR/paladin-dev-env/issues
- **Discussions**: [GitHub Discussions]https://github.com/DF3NDR/paladin-dev-env/discussions