AI Appliances

leanpub.com · 2026-08-04 · by Long Nguyen ·generic
Build and deploy production-ready AI agents in YAML. No vendor lock-in, no rewrites — Docker, Kubernetes, or standalone binary from the same workflow.

AI Appliances

About

1. About 2. Author 3. Contents 4. Sample

AI Appliances$0.00Pick your priceAdd to Cart

AI Appliances

Minimum price

Free!

Minimum paid price

$7.99

You pay

Author earns

You pay

$

Add to Cart

Add to Wishlist

✦Also available for 1 book credit with a Reader Membership

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.

    Share this book

    [](https://twitter.com/intent/tweet?text=AI%20Appliances&url=leanpub.com/kdeps&hashtags=undefined)[](https://www.facebook.com/sharer/sharer.php?display=popup&quote=AI%20Appliances%20on%20Leanpub&u=leanpub.com/kdeps&href=leanpub.com/kdeps)

    Categories

    Agentic EngineeringArtificial IntelligenceLarge language models

    Feedback

    Email the Author

    Author

    About the Author

    Joel Bryan Juliano

    [](https://twitter.com/joelbryan)[](https://github.com/jjuliano)[](https://linkedin.com/in/joeljuliano)

    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

    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. The Local LLM Comes Built In 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

    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. Built-In Agent Tools 8. Agent Registries (In-Memory) 9. Approval Tokens 10. REPL Slash Commands 11. Skills 12. Session Persistence 13. Mixing Modes: The Two-Layer Architecture 14. Limitations and Trade-offs 15. Next Steps

    Chapter 6: 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. Environment Variables in Config 11. Sampling Parameters 12. Vision (Multimodal Input) 13. Model Routing 14. Streaming (Ollama) 15. Chain-of-Thought and Few-Shot Selection 16. Provider-Specific Options 17. Choosing the Right Model 18. The Output

    Chapter 7: Data Resources

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

    Chapter 8: Knowledge Resources

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

    Chapter 9: 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 10: API Response and Validation

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

    Chapter 11: 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 12: 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 13: 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

    Chapter 14: 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 15: Sessions, CORS, and Route Restrictions

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

    Chapter 16: Advanced Configuration

    1. Persistent Memory Configuration 2. Rate Limiting 3. Trusted Proxies 4. TLS 5. Authentication 6. Security Headers 7. Body Size and Concurrency Limits 8. Request Body Size Preflight 9. Resource Output Caps 10. The Request Object 11. Health Endpoints 12. Per-Agent Config Profiles 13. Provider-Specific Chat Options 14. Production Security Checklist

    Chapter 17: 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 18: 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. NetworkPolicy (Opt-In) 9. Resource Limits 10. Horizontal Pod Autoscaling 11. Complete Production Setup 12. Updating a Deployment

    Chapter 19: Standalone Binary

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

    Chapter 20: 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

    Chapter 21: Validate, Debug, and Develop

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

    Chapter 22: Iteration — items and loop

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

    Chapter 23: 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 24: 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

    Chapter 25: 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

    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

    Download Sample PDFDownload Sample EPUB

    Also by the Author

    Also by the Author

  • From Ruby to Golang
  • Joel Bryan Juliano
  • Emacs for Life
  • Joel Bryan Juliano
  • AWS in Production
  • Joel Bryan Juliano
  • Distributed Systems in Go
  • Joel Bryan Juliano
  • Software Engineer
  • Joel Bryan Juliano
  • 面向所有人的 Kubernetes
  • Joel Bryan Juliano
  • From Ruby to Clojure
  • Joel Bryan Juliano
  • From Ruby to Rust
  • Joel Bryan Juliano
  • From Ruby to TypeScript
  • Joel Bryan Juliano
  • Kubernetes for All
Joel Bryan Juliano

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

leanpub.com · 14 images · 90 links

Comments (0)

No comments yet