Flows
Join the agents you already have into a graph, and let one call move between them without the caller starting over.
A flow is a graph of your existing agents: every node is one agent, every edge hands the live call from one agent to another. Reach for one when a single agent would have to be good at several unrelated jobs — triage, billing, scheduling — and you would rather keep each of those a small agent you can prompt and test on its own.
Beta — flows are off by default and enabled per workspace. Ask us to turn them on for yours.
curl -X POST https://api.kejue.co/v1/flows \
-H "Authorization: Bearer kejue_<prefix>_<secret>" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 018f4d7a-flow-support-front-door" \
--data '{
"slug": "support-front-door",
"name": "Support front door",
"start_agent_id": "TRIAGE_AGENT_ID",
"graph": {
"nodes": [
{"id": "triage", "agent_id": "TRIAGE_AGENT_ID", "x": 0, "y": 0},
{"id": "billing", "agent_id": "BILLING_AGENT_ID", "x": 320, "y": -120}
],
"edges": [
{
"id": "triage-to-billing",
"source": "triage",
"target": "billing",
"label": "billing",
"condition": "the caller asks about an invoice or a payment"
}
]
}
}'The graph
| Field | Meaning |
|---|---|
slug | Stable identifier, unique in your workspace: lowercase letters, digits and single hyphens, 2–64 characters. We derive one from name if you omit it. |
name | What you call the flow. Renaming never affects a running call. |
start_agent_id | The agent that answers. It must be one of the agents placed in the graph. |
graph.nodes[] | {id, agent_id, x, y}. id is yours and unique within the flow; agent_id is an active agent in the same workspace; x and y are canvas coordinates with no effect on a call. |
graph.edges[] | Directed handoffs between nodes. Every edge carries a required plain-language condition — see Handoffs. |
A node names an agent, not one of its versions: deploy a new version of a member agent and the next flow call runs it. Archived agents are rejected when you save.
The start agent
One node is the start: it answers the call, greets the caller, and behaves as it always does. From there the conversation follows the edges. A handoff continues the same conversation rather than starting a new one, so the whole flow stays one call record with one transcript and one recording.
Flows are live, not versioned
An agent has a draft you promote and deploy. A flow doesn't: save it and the next call uses the new graph. Calls already in progress keep the graph they started with. The flow itself has no publish step or version history; reviewable releases still belong to its member agents.
Because a flow is live, edits are race-sensitive. Reads return a strong ETag;
send it back in If-Match. PATCH is
partial — omitted fields keep their values — but graph is one document: send
it whole and it replaces the stored one.
Cloning a flow
Open a saved flow and choose Clone flow. Edit the suggested name and slug, then choose Clone flow. The new flow starts at revision 1 with the saved graph, start agent, description, and after-call settings. Both flows reference the same member agents and shared after-call resources. The clone starts without phone assignments or call history.
Use clone_flow in MCP or call
POST /v1/flows/{id}/clone with a new
name and an optional slug. The API requires flows:read, flows:create,
and the flows entitlement.
Operations
| Operation | Behavior |
|---|---|
GET /v1/flows | Cursor-paginated list; the usual query, date, and archive filters (Pagination). |
POST /v1/flows | Create a flow with its graph and start agent. Takes an Idempotency-Key. |
POST /v1/flows/{id}/clone | Clone the saved flow. Takes an Idempotency-Key. |
GET /v1/flows/{id} | One flow: graph, start agent, after-call configuration, and a strong ETag. |
PATCH /v1/flows/{id} | Partial update. Send the detail ETag as If-Match. |
DELETE /v1/flows/{id} | Idempotent soft-archive. Refused with 409 while a phone number still points at the flow — unassign the number first. |
Historical calls that ran through an archived flow stay readable, with the graph they used.
Your agents are not modified
The graph is the whole truth about handoffs while a flow call is running. Each
member agent's own system_tools.transfer_agent configuration is replaced
by the edges leaving its node, and an agent that is a leaf in the graph gets no
handoff tool at all. Nothing is written back: dial the same agent directly and
it behaves exactly as it always did, and archiving the flow leaves every agent
untouched. The details — and how to write a condition the model can act on —
are in Handoffs.
Everything else about a member agent is its own: prompt, voice, pipeline, tools, guardrails, pronunciation, transfers to humans, scheduled callbacks, and ending the call.
After the call
A flow carries its own summary, structured extraction, and webhook configuration, and it replaces the after-call configuration of every agent in it — so the result never depends on which agent happened to be holding the call when it ended. See After a flow call.
Pointing calls at a flow
Anywhere you point a call at an agent you can point it at a flow instead: an inbound phone number, a single outbound call, and a test call from the dashboard. Two limits are worth knowing before you plan a rollout — a phone number targets either an agent or a flow, never both, and campaigns still target a single agent. See Pointing calls at a flow.
Needs flows:read / flows:create / flows:update / flows:delete, and the
flows entitlement on the workspace.