Agent loop
The agent loop is a workflow chat with loop:. It calls tools over many rounds until the model gives a final answer. kdeps run runs it like any other resource. The default model is local, so it needs no API key and runs offline.
text
input -> chat (loop:) -> tool rounds -> answer -> next resourceWrite one
yaml
# workflow.yaml
apiVersion: kdeps.io/v1
kind: Workflow
metadata:
name: assistant
description: An agent that works on the files of this folder
version: "1.0.0"
targetActionId: assistant
deploy:
input:
sources: [interactive] # kdeps run opens a prompt; each line is one turnyaml
# resources/assistant.yaml
actionId: assistant
name: Assistant
chat:
model:
name: llama3.2:1b # local llamafile; set backend: for a cloud provider
context:
prompt: "{{ input('message') }}"
loop:
tools: [read_file, edit_file, list_files, search_local, bash_exec] # empty offers every built-in tool
maxRounds: 25 # tool rounds per request
session: "{{ get('session') }}" # one stored conversation across requestsRun kdeps new my-agent --template assistant to get these two files. Then run it:
bash
cd my-agent
kdeps run workflow.yaml # or bare: kdepsThe same chat serves an HTTP API, a bot, or a file when you change sources:. See Input sources.
What the loop adds
| Topic | Page |
|---|---|
| Built-in tool catalog and permission modes | Built-in tools |
| Tool calls that a model writes as text | Fenced tools |
| Shell execution and background jobs | Shell execution |
The subagent tool | Subagents |
| Independent review of the answer | Judge panel |
| One-time exceptions for a denied tool call | Approval tokens |
| Persistent memory | Persistent memory |
Skills and KDEPS.md instructions | Skills and instructions |
| Limits and thresholds as YAML | Reactive LLM events |
Every key is under the chat in the workflow. The full list is in the chat resource reference.
See also
- Workflow - the YAML pipeline
- Input sources - API, bot, file, or interactive prompt
- LLM provider reference - backend config and model names
- Agencies - several workflows as one system
