AI Flow
AI Flow (aiflow.svc, service identity ai-flow) is the platform’s flow/pipeline orchestration service. You author flows (DAGs of tasks), submit requests over HTTP, and AI Flow runs them on a fleet of agents — composing the flow engine (the execution engine) and the agent fabric (the agent fabric), with per-tenant persistence in PostgreSQL.
author a flow ──▶ submit a request ──▶ engine plans it ──▶ orchestrator picks an agent │ conversation memory + instance/runs persisted ◀── agent runs the task, streams backHow the pieces fit
Section titled “How the pieces fit”| Component | Role |
|---|---|
AI Flow (aiflow.svc) | HTTP surface, persistence, conversation memory, per-tenant wiring |
| the flow engine | DAG execution engine: parse → plan → dispatch → route; control-flow nodes; retry/timeout; pipelines |
| the agent fabric | gRPC orchestrator↔agent fabric; agent health & capacity; agent selection |
The 60-second tour
Section titled “The 60-second tour”1. A flow is a graph of tasks. The node’s kind comes from the key you use:
name: hellovars: { who: World }tasks: - name: build shell: "echo building..." next: { go: greet } - name: greet print: "Hello, {{who}}!"2. Run it locally:
kis flow -f hello.yaml -v who=Team3. Or deploy it as a tenant workflow and call it over HTTP:
curl -X POST https://<host>/workflow/start/sync/response \ -H "Authorization: Bearer $JWT" -H "Content-Type: application/json" \ -d '{"workflowname":"hello","context":{"who":"Team"}}'4. Add control flow — decisions, parallelism, iteration, human approval:
tasks: - name: route choice: rules: - condition: "env === 'production'" next: deploy-prod default: deploy-dev
- name: build-all map: { items_path: services, task: build-one, max_concurrency: 4 } next: { go: gate }
- name: gate wait: timeout: 1h events: - name: approved required: [approver] go: deploy-prod error: { go: escalate }Everything above — and more (subworkflows, retries, affinity, selectors, iterators, scripting in JS/Lua) — is covered in [Authoring flows](/blocks/ai/AI Flow/authoring-flows/).
Key ideas at a glance
Section titled “Key ideas at a glance”- Node type is inferred from the key —
shell:,choice:,map:,wait:… nonodetype:field. - One shared context per run; strings are Liquid (
{{var}}), conditions are the platform scripting runtime JS. - Selectors (
tag,model,gpu,cpu,memory,group) route a task to the right agent; affinity pins across runs. - Wait + Signal build human-in-the-loop and event-driven flows.
- Overflow queue absorbs bursts when agents are busy; work resumes automatically.
- Multi-tenant (CPET = Customer:Product:Environment:Tenant) with per-tenant PostgreSQL schemas + RLS.
Continue with:
- [Concepts](/blocks/ai/AI Flow/concepts/) — flows, instances, runs, agents, memory, tenancy: the vocabulary
- [Authoring flows](/blocks/ai/AI Flow/authoring-flows/) — the complete flow-authoring reference (formats, all node types, routing, templating, iterators, selectors, affinity, retry, scripting, recipes)
- [HTTP API](/api/AI Flow/) — every endpoint, with request/response shapes
- [Orchestration](/blocks/ai/AI Flow/orchestration/) — the the agent fabric fabric: wire protocol, agent lifecycle, selection, resilience
- [Operations](/blocks/ai/AI Flow/operations/) — build, config, deployment, tuning, observability, security