Skip to content

Edge AI Workflow Framework

Build AI agents for edge devices and APIs with YAML โ€” audio, video, and telephony input, offline LLMs, wake-phrase activation, and speech output. No cloud required.

agent.yaml
1name: support-agent
2resources:
3 - type: db
4 query: "SELECT * FROM tickets"
5 - type: python
6 script: classify.py
7 - type: llm
8 model: gpt-4o-mini
9 prompt: "Resolve: "
10 depends_on: [db, python]
# That's the whole agent.
running ยท port 8080startup: 0.4s

Introduction โ€‹

KDeps is a YAML-based workflow framework for building AI agents on edge devices and API backends. It combines multi-source hardware I/O (audio, video, telephony), offline-capable LLMs, speech recognition, wake-phrase activation, and text-to-speech into portable, self-contained units that run anywhere โ€” from Raspberry Pi to cloud servers.

Key Highlights โ€‹

Multi-Source I/O for Edge Devices โ€‹

KDeps accepts input from hardware devices and HTTP APIs โ€” simultaneously. Configure audio, video, telephony, and API sources in one workflow.yaml:

yaml
settings:
  input:
    sources: [audio]          # audio | video | telephony | api
    audio:
      device: hw:0,0          # ALSA device (Linux), microphone name (macOS/Windows)
    activation:
      phrase: "hey kdeps"     # Wake phrase โ€” workflow runs only when heard
      mode: offline
      offline:
        engine: faster-whisper
        model: small
    transcriber:
      mode: offline           # Fully local, no cloud required
      output: text
      offline:
        engine: faster-whisper
        model: small
SourceHardware
audioALSA microphone, line-in, USB audio
videoV4L2 camera, USB webcam, CSI camera
telephonySIP/ATA adapter, Twilio
apiHTTP REST (default)

Full Input Sources guide โ†’

Offline-First AI Stack โ€‹

Every AI component has an offline alternative โ€” run completely air-gapped:

ComponentOffline OptionsCloud Options
LLMOllama (llama3, mistral, phi)OpenAI, Anthropic, Google, Groq
STTWhisper, Faster-Whisper, Vosk, Whisper.cppOpenAI Whisper API, Deepgram, Google STT
TTSPiper, eSpeak-NG, Festival, Coqui TTSOpenAI TTS, ElevenLabs, Azure TTS
Wake PhraseFaster-Whisper, VoskDeepgram, AssemblyAI

YAML-First Configuration โ€‹

Build workflows using simple, self-contained YAML configuration blocks. No complex programming required - just define your resources and let KDeps handle the orchestration.

yaml
apiVersion: kdeps.io/v1
kind: Workflow
metadata:
  name: my-agent
  version: "1.0.0"
  targetActionId: responseResource
settings:
  apiServerMode: true
  apiServer:
    portNum: 16395
    routes:
      - path: /api/v1/chat
        methods: [POST]

Fast Local Development โ€‹

Run workflows instantly on your local machine with sub-second startup time. Docker is optional and only needed for deployment.

bash
# Run locally (instant startup)
kdeps run workflow.yaml

# Hot reload for development
kdeps run workflow.yaml --dev

Unified API โ€‹

Access data from any source with just two functions: get() and set(). No more memorizing 15+ different function names.

yaml
# All of these work with get():
query: get('q')                    # Query parameter
auth: get('Authorization')         # Header
data: get('llmResource')           # Resource output
user: get('user_name', 'session')  # Session storage

Mustache Expressions โ€‹

KDeps v2 supports both expr-lang and Mustache-style variable interpolation:

yaml
# expr-lang (functions and logic)
prompt: "{{ get('q') }}"
time:   "{{ info('current_time') }}"

# Mustache (simple variable access)
prompt: "{{q}}"
time:   "{{current_time}}"

# Mix in the same workflow
message: "Hello {{name}}, your score is {{ get('points') * 2 }}"

Use Mustache for simple variable access; use expr-lang for function calls, arithmetic, and conditionals. and are identical.

Learn more โ†’

LLM Integration โ€‹

Use Ollama for local model serving or any OpenAI-compatible API. Vision, tools, and streaming are supported.

Quick Start โ€‹

bash
# Install KDeps (Mac/Linux)
curl -LsSf https://raw.githubusercontent.com/kdeps/kdeps/main/install.sh | sh

# Or via Homebrew (Mac)
brew install kdeps/tap/kdeps

# Create a new agent interactively
kdeps new my-agent

Example: Simple Chatbot โ€‹

workflow.yaml

yaml
apiVersion: kdeps.io/v1
kind: Workflow
metadata:
  name: chatbot
  version: "1.0.0"
  targetActionId: responseResource
settings:
  apiServerMode: true
  apiServer:
    portNum: 16395
    routes:
      - path: /api/v1/chat
        methods: [POST]
  agentSettings:
    models:
      - llama3.2:1b

resources/llm.yaml

yaml
apiVersion: kdeps.io/v1
kind: Resource
metadata:
  actionId: llmResource
  name: LLM Chat
run:
  chat:
    model: llama3.2:1b
    prompt: "{{ get('q') }}"
    jsonResponse: true
    jsonResponseKeys:
      - answer

resources/response.yaml

yaml
apiVersion: kdeps.io/v1
kind: Resource
metadata:
  actionId: responseResource
  requires:
    - llmResource
run:
  apiResponse:
    success: true
    response:
      data: get('llmResource')

Test it:

bash
kdeps run workflow.yaml
curl -X POST http://localhost:16395/api/v1/chat -d '{"q": "What is AI?"}'

Documentation โ€‹

Getting Started โ€‹

Configuration โ€‹

Resources โ€‹

Concepts โ€‹

Deployment โ€‹

Tutorials โ€‹

Why KDeps v2? โ€‹

Featurev1 (PKL)v2 (YAML)
ConfigurationPKL (Apple's language)Standard YAML
Functions15+ to learn2 (get, set)
Startup time~30 seconds< 1 second
DockerRequiredOptional
Python envAnaconda (~20GB)uv (97% smaller)
Learning curve2-3 days~1 hour

Examples โ€‹

Explore working examples:

Edge AI / Voice:

API Backends:

Community โ€‹

Released under the MIT License.