AI Appliances: Build & Deploy Autonomous AI Agents and Agencies in YAML
About This Book
How This Book Is Organized
Code Conventions
Chapter 1: Why AI Appliances?
The Prototype Problem
The AI Appliance Model
Git Is the Source of Truth
What Makes Production AI Hard
Data Sovereignty
Two Modes, One Workflow File
Six Bounded Pieces, Pick What You Need
Who Is kdeps For?
No Lock-In, By Design
Built to Last
Two Things That Can Break
If You Are Coming From Another Framework
LangChain
LlamaIndex
OpenAI Assistants API
Mental Model for All Three
What You Will Build in This Book
Chapter 1 Quiz
3 attempts allowed
Chapter 2: Getting Started
Installing kdeps
macOS (Homebrew)
Linux and macOS (curl)
Windows (WSL or Git Bash)
From Source
Verify the Installation
Run the agent REPL first
The First Run Picks a Profile
The Local LLM Comes Built In
Creating Your First Project
The Workflow Entry Point
Adding an LLM Resource
Adding a Response Resource
Running the Workflow
How the Execution Flows
Hot Reload for Development
What You Just Built
Chapter 2 Quiz
3 attempts allowed
Chapter 3: Core Concepts
Resources: The Unit of Work
The DAG: Dependency-Ordered Execution
The Data Store: get() and set()
Workflow Mode vs. Agent Mode
Backends: Separating Model from Execution
Expressions: The Glue
Putting It Together
Chapter 3 Quiz
3 attempts allowed
Chapter 4: Workflow Mode
Starting a Workflow
Request Lifecycle
Declaring Dependencies with requires:
Parallel Execution
Validation
The before: and after: Blocks
Designing Effective DAGs
A Real-World Example: Document Q&A Pipeline
Multiple Routes on One Workflow
What Workflow Mode Is Not
Chapter 4 Quiz
3 attempts allowed
Chapter 5: Agent Mode
Starting Agent Mode
What the LLM Sees
Single Workflow vs. Folder Mode
Tool Inputs and Outputs
A Practical Example: Research Assistant
Tool Names Matter
Built-In Agent Tools
read_file’s visible whitespace
edit_file: a full command-dispatched editor
Jumping from search_local to read_file
Live tool monitor
Text-written tool calls and fake sandboxes
Failed tool calls, made visible
Session-integrity handshake
Permission modes, lean mode, and presets
Agent Registries (In-Memory)
TaskRegistry
TeamRegistry
CronRegistry
Approval Tokens
How it works in practice
CLI tools
Lifecycle
Goal-Directed Execution
Judge Panel
Prompt Refinement
Efficiency Enforcement
REPL Slash Commands
Response Rendering and Pasting
Line Editing and History Search
Multimodal Input
Auto-Detected Commands and Files
Themes
The Context-Path Status Line
Persistent Memory
How facts get in
The memory graph and what the model actually sees
Checkpoints and fold
Session Persistence and the Resume Picker
Local Model Management
Setting a Default Model
Managing Local Model Servers
Discovering and Downloading Models from HuggingFace
Registering a model by URL
Favorites and backend collisions
Auto-routing: --model auto and --model auto-router
Skills, Prompt Templates, and Instructions
Skills
Prompt templates
Instructions
konfig: Exporting and Importing Agent Configuration
Prompt Reduction with turo
Events and the Harness
The Desktop App
Mixing Modes: The Two-Layer Architecture
Limitations and Trade-offs
Next Steps
Chapter 5 Quiz
3 attempts allowed
Chapter 6: LLM Resources
Basic Usage
Full Configuration Reference
Structured JSON Output
jsonResponseKeys
System Prompts
Multi-Turn Conversations
tools: - Function Calling (Resource-Based Tools)
MCP External Tools
componentTools: - Component-Based Tools
Timeouts
Configuring Backends
Model Resolution Order
Llamafile (Local, the Default)
GGUF (llama.cpp)
Ollama (Local, Opt-In)
OpenAI
Anthropic
Groq
Google (Gemini)
Mistral
Cohere
DeepSeek
Together AI
Perplexity
xAI (Grok)
OpenRouter
AWS Bedrock and IBM WatsonX
Any OpenAI-Compatible Endpoint
Microsoft 365 Copilot
kdeps LLM server appliance
Per-Resource Backend Overrides
Environment Variables in Config
Sampling Parameters
Vision (Multimodal Input)
Model Routing
Routing Strategies
auto-router: Zero-Config Routing
Allowlist Mode
Streaming (Ollama)
Chain-of-Thought and Few-Shot Selection
Chain-of-Thought
Few-Shot Prompting
Semantic Few-Shot Selection
RAG Context Injection
Provider-Specific Options
Google AI (Gemini and Vertex AI)
Anthropic
OpenAI and Compatible Endpoints
Ollama Native Options
Choosing the Right Model
The Output
Chapter 6 Quiz
3 attempts allowed
Chapter 7: Data Resources
SQL Resource
Basic Usage
Connection Configuration
Result Formats
Multiple Queries and Transactions
Batch Inserts
Parameterized Queries
HTTP Client Resource
Basic Usage
Full Configuration Reference
Reading the Response
Retries
Authentication
Response Caching
TLS and Proxy
Accessing Response Details
Python Resource
Basic Usage
Full Configuration Reference
Python Package Management
Virtual Environment Isolation
Practical Example: Data Transformation
Passing Data to the Script
External Script Files
Accessing Output Details
Exec Resource
Configuration Reference
Basic Usage
Processing Files
Multi-Line Scripts
Environment Variables
Accessing Output Details
Installing OS Packages for Exec Commands
Security Considerations
File Component
Basic Usage
Operations
Patching Instead of Rewriting
Git Component
Combining Data Resources
Email Component
Global Named Connections
First-Run Setup and Environment Variable Connections
Sending Email
Reading, Searching and Organizing
Secrets
Chapter 7 Quiz
3 attempts allowed
Chapter 8: Knowledge Resources
Scraper Component
Basic Usage
CSS Selector Filtering
Full Configuration
Common Use Cases
Combining with LLM
Search Resources
Web Search
Web Search + Scrape + LLM Pattern
Local File Search
Indexed Search (Ranked Results)
Loader Resource
Embedding Resource
Operations
Indexing Documents
Searching
Upsert
Delete
Building a RAG Pipeline
Code Intelligence Resource
Navigating Code
Graphing a Folder
When to Use Each Knowledge Resource
Chapter 8 Quiz
3 attempts allowed
Chapter 9: Browser Automation
Why a Real Browser
Basic Usage
Browser Engines
Configuration Options
Actions
navigate
click
fill
evaluate
screenshot
wait
select
type
check / uncheck
hover
scroll
press
clear
upload
Authentication: Logging In
Session Persistence
Stealth Mode
Full Example: Extracting a Dynamic Dashboard
Headless vs. Headed Mode
Performance Considerations
When to Use Browser vs. Scraper vs. httpClient
Chapter 9 Quiz
3 attempts allowed
Chapter 10: API Response and Validation
The API Response Resource
Basic Structure
Full Configuration
Automatic and Manual Metadata
Dynamic Response Bodies
Error Responses
Choosing the Terminal Resource
Validations
Where Validations Live
Validation Execution Order
methods and routes
check
skip
error
Validation Placement Strategy
headers and params
Input Schema Validation
Multi-Field Validation Example
The onError Block
Practical: A Complete API with Proper Validation
Chapter 10 Quiz
3 attempts allowed
Chapter 11: Expressions and Data Flow
Two Syntaxes
The Data Store Functions
get(key)
set(key, value)
info(key)
env(key)
Resource-Specific Accessors
output(actionId)
session()
Standard Library
String Operations
Numeric Operations
List and Map Operations
JSON Operations
Type Functions
Date and Time
Conditional Operators
Operator Precedence
Helper Functions
safe(obj, path)
default(value, fallback)
debug(obj)
urlencode(string)
before: and after: Patterns
Input Normalization (before:)
Output Enrichment (after:)
Conditional Logic
Iterating with items: and loop:
items: - for each
loop: - while a condition holds
Practical: Data Pipeline with Expressions
The input Object Shorthand
Inline Resources in before: and after:
Jinja2 YAML Preprocessing
Common Mistakes
Chapter 11 Quiz
3 attempts allowed
Chapter 12: Components
Why Components
Registry Components
Using a Registry Component
Component Inputs
Reading Component Output
Components as LLM Tools
Custom Components
Directory Structure
Component Manifest
Component Resources
Using a Custom Component
Dependency Lifecycle: setup: and teardown:
Environment Variables and .env Auto-Loading
Input Validation
Packaging Components for Distribution
Design Principles for Components
The Component Registry at kdeps.io
Publishing to the Registry
Step 1: Tag a release
Step 2: Generate the formula
Step 3: Submit a PR
Chapter 12 Quiz
3 attempts allowed
Chapter 13: Agencies - Multi-Agent Systems
Why Agencies
Directory Structure
The Agency Manifest
Auto-Discovery Mode
Calling One Agent from Another
A Complete Multi-Agent Example
agent/greeter/workflow.yaml
agents/greeter/resources/understand.yaml
agents/greeter/resources/research.yaml
agents/greeter/resources/write.yaml
agents/greeter/resources/respond.yaml
agents/researcher/workflow.yaml
agents/researcher/resources/search.yaml
agents/researcher/resources/scrape.yaml
agents/researcher/resources/summarize.yaml
agents/writer/workflow.yaml
agents/writer/resources/draft.yaml
agents/writer/resources/respond.yaml
Running the Agency
Packed Agent Archives
Packaging the Entire Agency (.kagency)
Independent Deployment
Agency Design Principles
Chapter 13 Quiz
3 attempts allowed
Chapter 14: Workflow Configuration
Top-Level Structure
metadata
apiServer
Routes
TLS
Let’s Encrypt (custom domain)
Authentication
agentSettings
SQL connections
A Production-Ready workflow.yaml
Environment Variable Best Practices
Chapter 14 Quiz
3 attempts allowed
Chapter 15: Sessions, CORS, and Route Restrictions
Sessions
When to Use Sessions
Configuration
Using Sessions in Resources
Session ID
Multi-Turn Chatbot Example
Session TTL and Cleanup
Persistent Memory
When to Use Persistent Memory
How It Works
Writing to Memory
Searching Memory
Listing and Deleting
Auto-Extraction (Agent Mode Only)
Memory Graph
Relational Query (Agent Mode Only)
Compaction Integration
Session Persistence
Configuration
Memory vs. Sessions
CORS
Default Behavior
Configuration
Configuration Fields
CORS for Open-Origin APIs
CORS for Multi-Domain Internal Apps
Route and Method Restrictions
Method Restrictions
Route Restrictions
Route Wildcard Patterns
Combined Route + Method
Multi-Route Workflows
Putting It Together: A Stateful API
Chapter 15 Quiz
3 attempts allowed
Chapter 16: Advanced Configuration
Persistent Memory Configuration
Auto-Extraction (Agent Mode Only)
Session Persistence
Rate Limiting
Per-Route Rate Limiting
Trusted Proxies
TLS
Authentication
Security Headers
Body Size and Concurrency Limits
maxBodyBytes
maxConcurrent
Request Body Size Preflight
Per-Provider Limits
Error Message
Startup Warnings
Resource Output Caps
Per-Resource Executor Output Caps
The Request Object
Properties
File Methods
Practical Uses
Health Endpoints
Per-Agent Config Profiles
Agent Identity
Provider-Specific Chat Options
Google AI and Vertex AI
Anthropic Extended Output and Beta Features
Ollama Native Options
Production Security Checklist
Chapter 16 Quiz
3 attempts allowed
Chapter 17: Docker Deployment
The Two-Step Build
Packaging
What Goes Into the Archive
Building Docker Images
GPU Support
Inspecting the Generated Dockerfile
Multi-Architecture Builds
Running the Docker Image
With Volumes
With Ollama (Local LLM, Opt-In)
Pushing to a Registry
Environment Configuration Patterns
Image Size Optimization
CI/CD Integration
LLM server appliance (not an agent image)
HTTPS / custom domain
Chapter 17 Quiz
3 attempts allowed
Chapter 18: Kubernetes Deployment
Generating Manifests
What Gets Generated
Command Reference
Custom Image
Setting Replicas
CPU and Memory Limits
Adding Secrets and Config
Using ConfigMaps for Non-Secret Config
Persistent Storage
Exposing the Agent
Ingress (recommended)
LoadBalancer Service
Health Checks
NetworkPolicy (Opt-In)
Resource Limits
Horizontal Pod Autoscaling
Complete Production Setup
Updating a Deployment
LLM appliance manifests
HTTPS / custom domain
Chapter 18 Quiz
3 attempts allowed
Chapter 19: Standalone Binary
Overview
How It Works
Supported Architectures
Typical Workflow
Running the Prepackaged Binary
Edge Device Deployment
Embedding the Model: —include-models
Air-Gapped Environments
Systemd Service
Pinning the Runtime Version
Comparing Deployment Targets
LLM server appliances vs prepackage
Chapter 19 Quiz
3 attempts allowed
Chapter 20: WebServer Mode
Why WebServer Mode
Basic Configuration
Static File Serving
Subprocess Proxy Mode
React Example
Streamlit Example
Gradio Example
The Request Routing Logic
Production: Building the Frontend In
WebSockets
Development Workflow
Example: Full-Stack Agent with Dashboard
Chapter 21: Validate, Debug, and Develop
kdeps validate
What It Checks
Validating Before Deploying
Validation Exit Codes
kdeps doctor
Hot-Reload Development Mode
What Gets Reloaded
Watch Output
Debugging Resource Execution
Debug Mode
Record a session
Request IDs
FAQ and Common Problems
“Resource not found” after adding a new resource file
Validation passes but the workflow hangs
LLM response is empty
SQL query returns empty when you expect data
Expression errors at runtime
“Port already in use”
Python resource returns no output
Component not found
Logging and Observability
The Management API
Endpoints
Authentication
Checking Status
Hot-Updating a Running Container
Size Limits
Security Notes
Restart Persistence
Chapter 21 Quiz
3 attempts allowed
Chapter 22: Iteration - items and loop
items: - For-Each Iteration
Basic Usage
Dynamic Items from the Data Store
Item Context
Item-Scoped Storage
Collecting Results
Batch Processing Pattern
Image Batch Processing
loop: - While-Loop Iteration
Basic Usage
Loop Context
Loop-Scoped Storage
Iterating Until a Condition
Polling Pattern
Scheduling with at:
Accumulating LLM Conversations
maxIterations Safety
items vs. loop: Choosing the Right Tool
Chapter 22 Quiz
3 attempts allowed
Chapter 23: Error Handling with onError
The Default: Fail Loud
onError: Syntax
The Three Actions
action: fail (default)
action: continue
action: retry
The error Object
Conditional Error Handling with when:
Practical Patterns
Graceful Degradation
Retry with Logging
Circuit-Breaker Pattern
Error Handling vs. Validation
Chapter 23 Quiz
3 attempts allowed
Chapter 24: Real-World Examples
Example 1: Customer Support Bot (Multi-Turn)
Example 2: Document Processing Pipeline
Example 3: Autonomous Research Agency
Example 4: Content Moderation API
Example 5: Telegram Bot
Chapter 24 Quiz
3 attempts allowed
Chapter 25: Bot and File Input Sources
Three Input Sources
Bot Source
Supported Platforms
Configuration
WhatsApp: a Webhook Workflow
Execution Types
Reading Bot Input
Sending Replies
Complete Bot Example: Slack Assistant
Multi-Platform Bot
How Replies Are Delivered
Replying When a Step Fails
Sharing Logic Between an API and a Bot
Testing Without a Live Bot Connection
File Input Source
Configuration
Reading File Content
Reading Other Files with file()
The file() Function - Full Reference
Glob Patterns for Multiple Files
Complete File Processing Pipeline
Running the Same Pipeline as an API and a Batch Tool
Choosing an Input Source
Chapter 25 Quiz
3 attempts allowed
Chapter 26: LLM Server Appliance
Why a Separate Command
Commands
Interactive wizard
Client Contract
Stock Recipes (Default Formulas)
Override or add recipes
Docker
Kubernetes
ISO / Bootable Image
End-to-End Walkthrough
Auth and Security
What This Is Not
Related Chapters
Chapter 26 Quiz
3 attempts allowed
Final Exam
Final Exam
2 attempts allowed
Appendix A: Troubleshooting
Resource Did Not Execute
get() Returns null
Validation Always Fails (or Never Fires)
LLM Does Not See Context From a Previous Resource
DAG Cycle Error
Session Not Persisting Between Requests
HTTP Request Returns 500 With No Useful Message
Expression Evaluation Error: “undefined: X”
Resource Runs But Output Is Empty or Wrong Shape
kdeps validate Passes But Runtime Fails
Deployment: Docker Image Starts But Agent Returns Errors
Getting More Information
Record a Session for a Model to Debug
Appendix B: Security
Secrets Management
Never Hardcode Credentials
What to Put in Each Place
Scanning for Leaked Secrets
Prompt Injection
The Attack
Defenses
Authentication and Authorization
API Authentication
Management API Authentication
Per-Route Authorization
Token Rotation
Transport Security (TLS)
Let’s Encrypt custom domain
Static PEM or reverse proxy
Rate Limiting for Abuse Prevention
Capping Concurrent Requests
Security Headers (Automatic)
Input Validation as a Security Boundary
SQL Injection
Multi-Tenant Isolation
Logging and Audit Trails
Build-Time Secrets in Docker and Kubernetes Exports
Capping Resource Output Size
Security Checklist for Production Deployments
Appendix C: Testing Your Agent
What You Can Test Deterministically
What Requires Human Judgment or Statistical Evaluation
Smoke Testing With curl
Shell-Based Integration Test Script
Testing With --dev Hot Reload
Testing Validation Rules
Testing Session Persistence
Testing onError Paths
Testing Agent Mode Tool Selection
CI/CD Integration
What Not to Test
About the Author
Resources
Quick Reference
Key Commands
Resource Types Summary
Expression Quick Reference
Deployment Comparison
AI Appliances: The Course
Build and deploy autonomous AI agents and multi-agent agencies in YAML with kdeps.
Build autonomous AI agents and agencies in YAML and deploy them anywhere. All 26 chapters end with a quiz, and a final exam earns a certificate.
Minimum price
$79.00
$79.00
You pay
Author earns
About
About the Course
AI Appliances
Build and deploy autonomous AI agents and multi-agent agencies in YAML with kdeps.
What You'll Learn
✔ Understand AI appliances and kdeps core concepts
✔ Build in workflow mode and agent mode
✔ Use LLM, data and knowledge resources
✔ Automate the browser and validate API responses
✔ Compose components and multi-agent agencies
✔ Configure sessions, CORS and route restrictions
✔ Deploy with Docker, Kubernetes, a standalone binary or web server mode
✔ Validate, debug, iterate and handle errors with onError
Who Is This Course For?
Developers and engineers who want to build and ship AI agents without writing a large application stack.
Prerequisites
Comfort with the command line and YAML. Docker experience helps for the deployment chapters.
Why This Course?
It covers the whole path from a first workflow to deployed, multi-agent systems, with real-world examples and an LLM server appliance.
How It Works
- 26 chapters, each ending with a 5-question multiple-choice quiz (3 attempts, best score counts)
- A 20-question final exam covering the whole course
- 150 quiz questions in total
- Score 70% to pass; 85% or more earns honors
- Pass to receive a certificate of completion
Written by Joel Bryan Juliano.
This course is included in this track...
Instructor
About the Instructor
Hi, I'm Joel.
I am Dutch-Filipino Software Engineer with 20+ years of experience.
And with over 20 years in the game, I’ve seen it all and loved every minute of it.
My journey has taken me through a variety of industries, from sports streaming to cybersecurity, both in the private sector and for the Dutch government, and everything in between.
Along the way, I’ve picked up a diverse set of skills and experiences, in which I document into books.
Material
Course Material
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.
