Most agents improvise. This one compiles.
An ordinary agent decides what to do next, one turn at a time. AgentFlow decides before the run starts. You describe the work. It writes the workflow, compiles it into a fixed path, and calls a model only on the steps that need judgment. The rest runs as code.
Written by the people who know the process.
A workflow is a written spec: the steps, the tools each step may use, the checks that must pass, and where to branch. Each step becomes its own small agent with its own short instruction, or plain code when no judgment is needed.
rank the worst 3 lines every Monday{ "trigger": "cron", "steps": ["query", "rank", "report"], "assertions": ["rows > 0"] }worst 3 → worst 5 · saved as v2query → rank → check → reportThe spec is a versioned JSON document in your own object storage, not code in an engineering repo. Process engineers, quality leads and analysts write and change workflows without filing a ticket. AI engineering can read, diff and review every version, and the workflows stay yours.
Checked at every step. Stopped at the first doubt.
A gate holds the line. A map step puts 42 agents in flight at once. Each node can touch only what it was given.
- trigger
mon 09:00runs as codeMonday, 09:00. A schedule fires. It could as easily be an event, an API call, or a row landing in a table.
- query
pinned SQLruns as codeA query you already wrote, run as written. No model is involved, so this step costs nothing and cannot drift.
- gate
rows > 0checkBefore anything moves on: rows above zero, data under an hour old. Fail it twice and the run stops rather than publish.
- map
42 suppliersfans outOne step becomes forty-two. Every supplier gets its own agent, its own short instruction, and only the tools that step was given. Eight run at a time.
- reduce
42 into 1runs as codeForty-two results fold back into one table. The arithmetic is code rather than a model, so the numbers are exact.
- report
from aggregatescalls a modelThe one step that needs judgment. It reads the aggregates, never the raw rows and never the chart binaries.
- deliver
slack · run idruns as codePosted under the run id, with every step, every tool call and every gate outcome written to the ledger.
A loop wanders. A graph runs the order you defined.
Same tools, same data, same question. One decides its next move every turn. The other already knows, and runs the independent work at the same time.
Both reach an answer. The loop pays for every reconsideration on the way, and nothing in it makes a wrong turn impossible. In the graph the wrong step cannot be reached, so the only calls it makes are the ones the work needed.
Semantics, ontology, context.
A model that can only see numbers can only describe them. To find a cause and propose a fix, an agent has to know what the numbers mean, what they are attached to, and what is going on around them. Each is a layer, and each one is yours to govern.
| Layer | What it holds | Where it lives | What it is for |
|---|---|---|---|
| Semantics | Measures, dimensions, joins, grain and metric logic, and the tree that rolls each metric up into the next. | Your semantic layer: Cube, or self-hosted. Governed by the team that already governs your BI. | Bounds what the agent can ask for. The layer writes the SQL, so raw SQL and catalog browsing leave the toolset. |
| Ontology | The entities of the business and how they relate: orders, shipments, carriers, SKUs, suppliers, lines, accounts, and who owns each. | Built from your catalog and your systems of record, kept in your own storage. | Traces a number to a thing someone can fix, and to the person who owns the decision. |
| Context | Policies, thresholds, contracts, calendars, playbooks, and the facts learned on earlier runs. | Skills package the playbooks. Project memory carries facts from run to run. Connected systems supply the rest over MCP. | Tells the agent what matters, what is allowed, and what to recommend. |
It asks for measures, not tables.
Point a project at your semantic layer and the raw-SQL and catalog-browsing tools leave the toolset. What the model can ask for is what the layer defines, and the layer writes the SQL.
Browse the catalog, pick the tables and the join, hand-write the SQL. The definition of revenue lives in whoever wrote the query. Two workflows can answer the same question two ways and both look right.
Ask for a measure and a dimension. The layer resolves joins and grain; SQL is generated, then run. One definition of revenue, shared by every workflow. Raw SQL is not in the toolset, and a blocked tool reached another way is refused.
The compiler decides which steps are reachable; the semantic layer decides which numbers are askable. Governance you already wrote for your BI tools now bounds the agent.
Nine building blocks.
Your team combines them in plain English. Nobody writes application code.
01 · Boundaries in the architecture, not the prompt
A goal-driven agent is told what not to do in its system prompt, and can drift past it. Here the compiler controls the graph: the wrong tool is not in the step's toolset and the wrong step is not reachable.
02 · Eight step types, with gates
An agent step reasons openly toward a goal. A guided step must call a named tool to advance. A conditional step branches on a value from an earlier step. A map step fans out over a list. A transform step runs SQL with no model call at all. A wait-for-input step pauses for a person, an action step changes something in the world, and a subworkflow step calls another workflow you already published. Any step can carry gate checks, assertions, and retry with the validator's complaint as context.
03 · Parallel by design, one agent per item
A map step takes a list produced earlier in the run, starts one scoped agent per item, and folds every result back into a single output through a reduce before the graph moves on. You set how many item agents run at once, from 1 to 256, and each one can carry its own pinned model. Triggers fan out the same way at the workflow level, firing as many as 10 workflows from one event.
04 · A small agent per step keeps runs cheap
Each step sees only its own tools and instruction, so context stays small and prompt caching applies per step. Steps whose work is fully determined compile down to code and call no model at all. On the supplier-risk workflow we benchmarked, that is 380 model tokens a run against 8,289 on the best-tuned AWS build (provisional until the final receipt is attached).
05 · A model chosen per step
Every step that calls a model can name the one it runs on, picked from the model registry your admin curates. Heavy reasoning sits on a frontier model while bulk extraction runs on a cheaper one, and a step that touches sensitive data can be pinned to a self-hosted model. A pin naming a model nobody registered fails the build rather than quietly running on something else.
06 · Triggers as a single record
One persisted trigger holds the cron expression or webhook URL, fan-out to as many as 10 workflows, per-workflow input mapping, retry policy, and its own last-fired audit. Authored once, reused everywhere.
07 · Action steps that can be approved
For steps that change something in the world, the lifecycle is fixed: plan, freeze the plan with a fingerprint of its inputs, route for approval with timeouts and escalation, execute only on approval, then write an append-only audit record.
08 · Skills, subagents, MCP servers, and your own tools
A skill is a packaged playbook for a class of problem. A subagent handles a delegated sub-task with its own reasoning loop. A custom tool is your Python function, registered once and callable from any step in any workflow. An MCP server you already run plugs in as a connection, and you can pare a chatty server down to the few tools you want. Its token travels in the outbound request to your server and never enters the model's context.
09 · Memory, observability, and audit
Run state is checkpointed so a run survives a restart or waits days for a human. Project memory holds facts across runs, catalog memory holds descriptions and embeddings of your data, and every run emits a structured event stream with per-step token usage.
Between your people and your storage.
The runtime sits between the people and systems that start work and the storage that holds your data and your workflows. Models are called from the runtime, and from nowhere else.
Works with what you already chose.
Questions engineers ask
Is every step a call to a model?
No, and the builder badges each step so you can see. A step whose work is fully determined, such as a query you already have, arithmetic, or a delivery, is compiled to code and calls no model. What is left are the steps that need judgment.
How do you stop it from querying the wrong thing?
Point the project at your semantic layer and the raw-SQL and catalog-browsing tools leave the toolset. The agent can ask only for the measures and dimensions the layer defines, and the layer resolves the joins and writes the SQL.
Can steps run in parallel?
Yes. A map step turns a list into one small agent per item, runs them at once, and folds the results into a single output before the next step starts. You cap how many run at a time, from 1 to 256, and each can carry its own model. One trigger can also start as many as 10 workflows from a single event.
Can we use one model for the hard steps and a cheaper one for the rest?
That is the normal way to build here. A model is pinned per step, because steps are not equally hard. Heavy reasoning can sit on a frontier model while extraction and formatting run on something much smaller, including an open-weights model you host. A pin that names a model nobody registered fails the build.
Can we bring our own tools and MCP servers?
Yes. Register a Python function once and any step can call it. Connect an MCP server over HTTP or SSE, with a token or OAuth, and expose only the tools you want. If a server is slow or down, that turn runs without its tools; the run does not fail.
Why do short instructions matter so much?
Because long ones are not followed. Give a model a hundred-line instruction and, over a thousand runs, it will quietly drop two or three of those lines. In our own tests a three-to-five line instruction is followed almost perfectly. Breaking a process into steps is what makes short instructions possible.
Did you build the graph engine yourselves?
At the lowest level we use primitives from LangGraph for ordinary agent mechanics. The compiler, the state graph, the determinism and the context handling are ours, built on top. That layer is the product.
Workflow spec
Every field of the JSON document a workflow compiles from.
Read moreStep types
Agent, guided, conditional, map, transform, wait for input, action, subworkflow.
Read moreGates and assertions
Writing checks, retries, and what a failed run reports.
Read moreSemantic layer
Binding a project to Cube and what leaves the toolset when you do.
Read moreMCP connections
HTTP and SSE, tokens and OAuth, trimming a server's tools.
Read moreModel registry
Registering providers and pinning a model to a step.
Read moreSee your own workflow compile.
Bring one process to a call. We will write it in chat, compile it, and show you which steps call a model and which don't.
Read the docsAn actual person replies, usually within one working day.