Quickstart: full text
This page has every step and detail. The overview is the short version.
Build a two-resource LLM API from one workflow.yaml. With loop: on the chat, the same file is an agent loop.
The mental model
A resource is one step in its own YAML file (here: an LLM call, then a response). A workflow is a folder of resources plus a workflow.yaml manifest. Each resource names what it requires:, and kdeps runs the steps in that dependency order (a DAG). The next step reads the output of a step with get('<actionId>'). This fixed order is the pipeline, and it is what you deploy.
Overview
This quickstart guides you through:
- Creating a project
- Writing a two-resource workflow (an LLM call and a response)
- Running it as an HTTP API
It is for developers who have used a terminal and an HTTP API before. For install options (Windows, source, Docker), see Installation.
Before you start
- kdeps installed (
kdeps --version) - No LLM server: models run as local llamafiles (the default
filebackend). On the first run, you confirm the default model (llama3.2:1b, about 1.1 GB). Then kdeps downloads it to~/.kdeps/models/automatically.
Create a project
kdeps new my-agent
cd my-agentOr create the structure manually:
mkdir -p my-agent/resources && cd my-agentDefine your workflow
workflow.yaml:
# workflow.yaml
apiVersion: kdeps.io/v1
kind: Workflow
metadata:
name: my-agent
version: "1.0.0"
targetActionId: response
deploy:
apiServer:
hostIp: "127.0.0.1"
portNum: 16395
routes:
- path: /api/v1/chat
methods: [POST]Add an LLM resource
resources/llm.yaml:
# resources/llm.yaml
actionId: llm
name: LLM Chat
validations:
methods: [POST]
routes: [/api/v1/chat]
check:
- get('q') != ''
error:
code: 400
message: "'q' is required"
chat:
model:
name: llama3.2:1b
timeout: 60s
context:
role: user
prompt: "{{ get('q') }}"Add a response resource
resources/response.yaml:
# resources/response.yaml
actionId: response
name: API Response
flow:
requires: [llm]
apiResponse:
success: true
response:
# chat output is the raw response object; the reply text is at .message.content
answer: get('llm').message.contentRun it
When you configure apiServer, kdeps needs an API auth token before it starts. Set one for local development (never in workflow.yaml):
export KDEPS_API_AUTH_TOKEN=dev-token
kdeps run workflow.yamlYou can also set api_auth_token in ~/.kdeps/config.yaml. See Security reference.
Test the API:
curl -X POST http://localhost:16395/api/v1/chat \
-H "Authorization: Bearer $KDEPS_API_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"q": "What is entropy?"}'Expected response:
{
"success": true,
"data": {
"answer": "Entropy is a measure of disorder..."
}
}How it works
requires: [llm] means response will not run until llm has finished. This two-resource DAG is the simplest pipeline.
Next steps
- Workflow - how the pipeline runs
- Agent loop - a chat with
loop: - workflow.yaml reference - every field
- Resources overview - all resource types
- CLI reference - all commands and flags
