Kick off your book project in 2 hours! Live workshop on Zoom. You’ll leave with a real book project, progress on your first chapter, and a clear plan to keep going. Tuesday, June 16, 2026. Learn more…

Leanpub Header

Skip to main content

AI Appliances

Build & Deploy Autonomous AI Agents and Agencies in YAML

This book is 100% completeLast updated on 2026-06-05

Your AI prototype works. Now ship it.

Most AI frameworks are built for exploration. kdeps is built for production. Define your agent in YAML, declare its dependencies, and deploy it anywhere — Docker, Kubernetes, a standalone binary, an edge device — without rewriting a line when you switch LLM providers.

AI Appliances is the hands-on guide to building autonomous AI agents and multi-agent systems with kdeps: deterministic pipelines, real error handling, real deployment, and no vendor lock-in.

Write YAML. Run anywhere. Own everything.

Minimum price

Free!

$7.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
About

About

About the Book

Most AI tooling is built for the demo, not the shift. You get a working prototype, someone wants to put it in production, and suddenly you're asking: how do I validate inputs? How do

I retry a flaky API? How do I deploy this without rewriting it? How do I switch models without touching every file?

AI Appliances answers all of those questions with a single framework: kdeps.

kdeps lets you define AI agents as YAML workflows — deterministic pipelines of resources (LLM calls, SQL queries, HTTP requests, Python scripts, browser automation) connected in a

dependency graph. You declare what each step does and what it depends on. kdeps handles execution, validation, retries, error handling, and deployment.

This book is the complete guide to building with kdeps, from a first working agent to a multi-agent system running in production on Kubernetes.

You will learn how to:

  • Build deterministic AI pipelines using a directed acyclic graph (DAG) of typed resources
  • Wire LLM calls, SQL queries, HTTP clients, Python scripts, web scrapers, and browser automation into a single workflow
  • Validate inputs, handle errors gracefully, and make agents resilient to real-world conditions
  • Compose reusable components and build multi-agent agencies where specialized agents collaborate autonomously
  • Deploy to Docker, Kubernetes, standalone binaries, or edge devices — from the same YAML, without changing a line
  • Run local open-source LLMs via Ollama, or route to OpenAI, Anthropic, Gemini, Perplexity, or any compatible provider
  • Debug with kdeps validate, kdeps doctor, hot-reload development mode, and trace logging
  • Build native chat bots for Telegram, Discord, Slack, and WhatsApp — or process files from the command line — with the same resource DAG, just a different input source

What this book is not: a machine learning theory text, a prompt engineering tutorial, or a guide to any proprietary AI platform. It is a book about running AI in production as reliably as you run a database.

What you need: familiarity with YAML and basic command-line comfort. No prior AI/ML experience required.

Author

About the Author

Joel Bryan Juliano

Hi, I'm Joel.

I am Senior 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.

Originally from the Philippines, I am now a Dutchman living in Amsterdam together with my family.

My journey has taken me through a variety of industries, from sports streaming to cybersecurity, and everything in between.

Along the way, I’ve picked up a diverse set of skills and experiences, in which I document into books.

Contents

Table of Contents

AI Appliances: Build & Deploy Autonomous AI Agents and Agencies in YAML

  1. About This Book
  2. How This Book Is Organized
  3. Code Conventions
  4. Part I: Foundation

Chapter 1: Why AI Appliances?

  1. The Prototype Problem
  2. The AI Appliance Model
  3. What Makes Production AI Hard
  4. Two Modes, One Workflow File
  5. Who Is kdeps For?
  6. No Lock-In, By Design
  7. Built to Last
  8. If You Are Coming From Another Framework
  9. What You Will Build in This Book

Chapter 2: Getting Started

  1. Installing kdeps
  2. Installing a Local LLM
  3. Creating Your First Project
  4. The Workflow Entry Point
  5. Adding an LLM Resource
  6. Adding a Response Resource
  7. Running the Workflow
  8. How the Execution Flows
  9. Hot Reload for Development
  10. What You Just Built

Chapter 3: Core Concepts

  1. Resources: The Unit of Work
  2. The DAG: Dependency-Ordered Execution
  3. The Data Store: get() and set()
  4. Workflow Mode vs. Agent Mode
  5. Backends: Separating Model from Execution
  6. Expressions: The Glue
  7. Putting It Together
  8. Part II: Building Agents

Chapter 4: Workflow Mode

  1. Starting a Workflow
  2. Request Lifecycle
  3. Declaring Dependencies with requires:
  4. Parallel Execution
  5. Validation
  6. The before: and after: Blocks
  7. Designing Effective DAGs
  8. A Real-World Example: Document Q&A Pipeline
  9. Multiple Routes on One Workflow
  10. What Workflow Mode Is Not

Chapter 5: Agent Mode

  1. Starting Agent Mode
  2. What the LLM Sees
  3. Single Workflow vs. Folder Mode
  4. Tool Inputs and Outputs
  5. A Practical Example: Research Assistant
  6. Tool Names Matter
  7. Agent Mode Over HTTP
  8. Mixing Modes: The Two-Layer Architecture
  9. Limitations and Trade-offs
  10. Next Steps

Chapter 6: Bot and File Input Sources

  1. Three Input Sources
  2. Bot Source
  3. The botReply: Resource
  4. File Input Source
  5. Choosing an Input Source

Chapter 7: LLM Resources

  1. Basic Usage
  2. Full Configuration Reference
  3. Structured JSON Output
  4. System Prompts
  5. Multi-Turn Conversations
  6. tools: — Function Calling (Resource-Based Tools)
  7. componentTools: — Component-Based Tools
  8. Timeouts
  9. Configuring Backends
  10. Sampling Parameters
  11. Vision (Multimodal Input)
  12. Model Routing
  13. Streaming (Ollama)
  14. Choosing the Right Model
  15. The Output

Chapter 8: Data Resources

  1. SQL Resource
  2. HTTP Client Resource
  3. Python Resource
  4. Exec Resource
  5. Combining Data Resources

Communication Resources: Email

  1. Global Named Connections
  2. Sending Email
  3. Reading Email
  4. Searching Email
  5. Modifying Messages
  6. Output Shape
  7. Configuration Reference
  8. Secrets

Chapter 10: Knowledge Resources

  1. Scraper Resource
  2. Search Resources
  3. Embedding Resource

Chapter 11: Browser Automation

  1. Why a Real Browser
  2. Basic Usage
  3. Browser Engines
  4. Actions
  5. Authentication: Logging In
  6. Session Persistence
  7. Full Example: Extracting a Dynamic Dashboard
  8. Headless vs. Headed Mode
  9. Performance Considerations
  10. When to Use Browser vs. Scraper vs. httpClient

Chapter 12: API Response and Validation

  1. The API Response Resource
  2. Validations
  3. The onError Block
  4. Practical: A Complete API with Proper Validation

Chapter 13: Expressions and Data Flow

  1. Two Syntaxes
  2. The Data Store Functions
  3. Standard Library
  4. Helper Functions
  5. before: and after: Patterns
  6. Practical: Data Pipeline with Expressions
  7. The input Object Shorthand
  8. Inline Resources in before: and after:
  9. Jinja2 YAML Preprocessing
  10. Common Mistakes

Chapter 14: Components

  1. Why Components
  2. Registry Components
  3. Components as LLM Tools
  4. Custom Components
  5. Design Principles for Components
  6. The Component Registry at kdeps.io
  7. Publishing to the Registry

Chapter 15: Agencies — Multi-Agent Systems

  1. Why Agencies
  2. Directory Structure
  3. The Agency Manifest
  4. Calling One Agent from Another
  5. A Complete Multi-Agent Example
  6. Running the Agency
  7. Packed Agent Archives
  8. Packaging the Entire Agency (.kagency)
  9. Independent Deployment
  10. Agency Design Principles
  11. Part III: Configuration & Operations

Chapter 16: Workflow Configuration

  1. Top-Level Structure
  2. metadata
  3. apiServer
  4. agentSettings
  5. sqlConnections
  6. A Production-Ready workflow.yaml
  7. Environment Variable Best Practices

Chapter 17: Sessions, CORS, and Route Restrictions

  1. Sessions
  2. CORS
  3. Route and Method Restrictions
  4. Putting It Together: A Stateful API

Chapter 18: Advanced Configuration

  1. Rate Limiting
  2. Trusted Proxies
  3. TLS
  4. Authentication
  5. Body Size and Concurrency Limits
  6. Resource Output Caps
  7. The Request Object
  8. Health Endpoints
  9. Per-Agent Config Profiles
  10. Production Security Checklist
  11. Part IV: Deployment

Chapter 19: Docker Deployment

  1. The Two-Step Build
  2. Packaging
  3. Building Docker Images
  4. Running the Docker Image
  5. Pushing to a Registry
  6. Environment Configuration Patterns
  7. Image Size Optimization
  8. CI/CD Integration

Chapter 20: Kubernetes Deployment

  1. Generating Manifests
  2. What Gets Generated
  3. Command Reference
  4. Adding Secrets and Config
  5. Persistent Storage
  6. Exposing the Agent
  7. Health Checks
  8. Resource Limits
  9. Horizontal Pod Autoscaling
  10. Complete Production Setup
  11. Updating a Deployment

Chapter 21: Standalone Binary

  1. Overview
  2. How It Works
  3. Supported Architectures
  4. Typical Workflow
  5. Running the Prepackaged Binary
  6. Edge Device Deployment
  7. Air-Gapped Environments
  8. Systemd Service
  9. Pinning the Runtime Version
  10. Comparing Deployment Targets

Chapter 22: WebServer Mode

  1. Why WebServer Mode
  2. Basic Configuration
  3. Static File Serving
  4. Subprocess Proxy Mode
  5. The Request Routing Logic
  6. Production: Building the Frontend In
  7. WebSockets
  8. Development Workflow
  9. Example: Full-Stack Agent with Dashboard

WebAssembly — Browser and Edge Deployment

  1. What WASM Mode Is
  2. Getting the Files
  3. Browser Quickstart
  4. The JavaScript API
  5. Connecting to LLM Providers
  6. WASM Compatibility
  7. Writing WASM-Compatible Workflows
  8. Framework Integration
  9. Edge Runtimes
  10. Building from Source
  11. Comparing Deployment Targets
  12. Part V: Going Further

Chapter 23: Validate, Debug, and Develop

  1. kdeps validate
  2. kdeps doctor
  3. Hot-Reload Development Mode
  4. Debugging Resource Execution
  5. Debugging Agent Mode
  6. FAQ and Common Problems
  7. Logging and Observability
  8. The Management API

Chapter 24: Iteration — items and loop

  1. items: — For-Each Iteration
  2. loop: — While-Loop Iteration
  3. items vs. loop: Choosing the Right Tool

Chapter 25: Error Handling with onError

  1. The Default: Fail Loud
  2. onError: Syntax
  3. The Three Actions
  4. The error Object
  5. Conditional Error Handling with when:
  6. Practical Patterns
  7. Error Handling vs. Validation

Chapter 26: Real-World Examples

  1. Example 1: Customer Support Bot (Multi-Turn)
  2. Example 2: Document Processing Pipeline
  3. Example 3: Autonomous Research Agency
  4. Example 4: Content Moderation API
  5. Example 5: Telegram Bot

Appendix A: Troubleshooting

  1. Resource Did Not Execute
  2. get() Returns null
  3. Validation Always Fails (or Never Fires)
  4. LLM Does Not See Context From a Previous Resource
  5. DAG Cycle Error
  6. Session Not Persisting Between Requests
  7. HTTP Request Returns 500 With No Useful Message
  8. Expression Evaluation Error: “undefined: X”
  9. Resource Runs But Output Is Empty or Wrong Shape
  10. kdeps validate Passes But Runtime Fails
  11. Deployment: Docker Image Starts But Agent Returns Errors
  12. Getting More Information

Appendix B: Security

  1. Secrets Management
  2. Prompt Injection
  3. Authentication and Authorization
  4. Transport Security (TLS)
  5. Rate Limiting for Abuse Prevention
  6. Input Validation as a Security Boundary
  7. SQL Injection
  8. Multi-Tenant Isolation
  9. Logging and Audit Trails
  10. Security Checklist for Production Deployments

Appendix C: Testing Your Agent

  1. What You Can Test Deterministically
  2. What Requires Human Judgment or Statistical Evaluation
  3. Smoke Testing With curl
  4. Shell-Based Integration Test Script
  5. Testing With --dev Hot Reload
  6. Testing Validation Rules
  7. Testing Session Persistence
  8. Testing onError Paths
  9. Testing Agent Mode Tool Selection
  10. CI/CD Integration
  11. What Not to Test

About the Author

Resources

Quick Reference

  1. Key Commands
  2. Resource Types Summary
  3. Expression Quick Reference
  4. Deployment Comparison

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

Also by the Author

Also by the Author

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.)

In fact, authors have earned over $15 million writing, publishing and selling 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.

Learn more about writing on Leanpub