> Source: https://wexa.ai/docs/tools/create-process-flow

# create-process-flow

Create a multi-agent process flow. Two modes: (1) shell-only -- pass just name/description/role to create an empty flow you'll add agents to later, one at a time, via update-process-flow; (2) full manifest -- pass a `manifest` (Process Flow Manifest v1.0: flow, agents[] of skilled_agent/decider_agent nodes, wiring) to provision the flow + all agents + wiring in ONE call. Prefer the manifest form whenever you already know the complete structure -- e.g. after reasoning about what the request needs, or after running a compiler-style flow and reading its raw JSON via get-execution's last_agent_output (never its conclusion, which is always prose). Use mode="upsert" to update an existing flow by name instead of erroring on a duplicate. If any agent needs a skill (connector action), call list-skills first to find its real id -- this tool never creates skills, only references existing ones. See docs \{topic:'orchestrate'\} for the full manifest contract and a worked example.

## What it is called on each surface

The wire name is `create-process-flow` everywhere: it is what the Wexa MCP server advertises, the REST path is
`POST /v1/create-process-flow`, and each SDK exposes it under its own language's naming convention.

| Surface | Name |
| --- | --- |
| Wexa MCP server | `create-process-flow` |
| REST API | `POST /v1/create-process-flow` |
| TypeScript SDK | `fabric.createProcessFlow()` |
| Python SDK | `fabric.create_process_flow()` |

## Arguments

None of the 7 arguments is declared required: the gateway's schema for this tool has no required set, so nothing is refused at the validation stage. A call passing only `name` and `description` is accepted and creates a bare flow. Supply a `manifest` instead when you want the agents and their wiring created in the same call.

| Argument | Type | Required | Notes |
| --- | --- | --- | --- |
| `description` | string | Optional | Optional. |
| `flow_name` | string | Optional | Only used together with `manifest`. Optional override for manifest.flow.name. |
| `kb_tags` | array | Optional | Only used together with `manifest`. Sets manifest.knowledge_base.tags and its ingest entries, and REPLACES (never merges with) the context of every agent with has_knowledge_base true. Required when the manifest leaves knowledge_base.tags empty and an ingest entry has no tags of its own. Each entry must be a tag token (e.g. "b2b_saas_icp"), never a sentence: retrieval matches tags by exact string, so a prose context is refused. |
| `manifest` | object | Optional | The declarative form: agents and wiring in one payload. Supply this, or `name` for a bare flow — the gateway declares neither required, and a call carrying only `name` and `description` is accepted. |
| `mode` | one of 3 | Optional | Only used together with `manifest`. create (default) always creates a new flow — names are NOT unique, so a retried create leaves a duplicate. create_if_absent returns the existing flow untouched if the name is taken, so it is safe to repeat. upsert updates the flow with this name, replacing its agents. Both name-based modes fail with 409 if several flows share the name. One of: `create`, `create_if_absent`, `upsert`. |
| `name` | string | Optional | Names the flow when you are not supplying a `manifest`. Names are not unique. |
| `role` | string | Optional | Optional. |

`project_id`, `projectID`, `organization_id` and `executed_by` are not arguments you pass: the
platform binds all four from the credential you authenticated with, and both SDKs refuse them
before the request leaves your process — see
[server-bound arguments](/docs/get-started/scope-and-server-bound-arguments).

## The three node types

Every entry in `manifest.agents[]` is one node in the process flow. `type` picks which kind, and
**it defaults to `skilled_agent` when you leave it out**. There are three, and no others: an
unknown `type` is refused with a message naming all three.

| `type` | What the node does | You must set | Refused on this type |
| --- | --- | --- | --- |
| `skilled_agent` | Runs the task itself, inside Wexa, using the skills you give it. The default. | `skills` — **or** make it conversational: `role: "conversational"` with `has_knowledge_base: true` and a non-empty `context` | `registration_id` |
| `decider_agent` | Branches. It picks one route and the flow carries on down it. | `conditions`, at least 2, one per branch; `next_agents` maps each decision to another agent's `ref` | `registration_id`, `is_terminal_agent`, `is_user_specific_task` |
| `interop_agent` | The external agent node. Hands the whole task to an agent on another platform and waits for it. | `registration_id` — a peer agent connection from [`list-peer-agents`](/docs/tools/list-peer-agents) | `skills`, `is_preview_mode_enabled`, `conditions`, `is_terminal_agent`, `is_user_specific_task` |

A skilled agent with no skills is refused, because the executor cannot run it. The refusal says so
and offers the conversational form as the alternative — `context` is an ARRAY of tag tokens like
`["b2b_saas_icp"]`, never a sentence.

### Settings every node type takes

| Field | Type | Leave it out and… |
| --- | --- | --- |
| `title` | string | Required. It is how the node is named everywhere a person looks. |
| `role`, `role_description` | string | Empty. |
| `prompt` | object | `{"template": "..."}` is the task. `display_template` is derived from `template` when you omit it. |
| `llm` | object | `model` is an id from list-models `settable`; omitted, the agent is stored with your organization's default registry model, or the first registry model when none is marked default. `max_tokens` 4000; `temperature` 0. |
| `has_knowledge_base` + `context` | boolean + array | Off. `context` holds tag tokens, matched against document tags by exact string. |
| `context_access` | object | **Full access.** Send `{"mode": "off"}` to withhold the context graph, or `"brief_only"` for the project brief alone. `mode` is required whenever you send the object at all. |
| `agent_base_prompt` | string | The platform default reasoning prompt. |
| `context_required` + `context_target_agent_ids` | boolean + array | Off. When on, name the earlier agents by their `ref`. |

### Settings only a skilled agent takes

| Field | Type | Leave it out and… |
| --- | --- | --- |
| `is_preview_mode_enabled` | boolean | Automatic approval. `true` pauses the node for a person to approve. |
| `is_terminal_agent` | boolean | Off. Marks the node as the end of the flow. It is recorded and read back, but nothing in the run engine acts on it yet. |
| `is_user_specific_task` | boolean | Off. `true` runs the task once per active user rather than once for the whole flow. |

### An external agent node, end to end

Register the external agent first, then point a node at the connection it returns:

```python
conn = fabric.register_peer_agent(
    name="invoice-reconciler",
    endpoint="https://agents.example.com/a2a/invoice-reconciler",
    protocol="a2a",                 # or "mcp"
    secret="<the external agent's token>",
)

fabric.create_process_flow(manifest={
    "manifest_version": "1.0",
    "flow": {"name": "Invoice reconciliation", "role": "conversational"},
    "agents": [{
        "ref": "reconcile",
        "type": "interop_agent",
        "title": "Reconcile with the finance platform",
        "prompt": {"template": "Reconcile the outstanding supplier invoices."},
        "registration_id": conn["connection_id"],
        "next": None,
    }],
    "wiring": {"initial_agent": "reconcile"},
})
```

The node carries no skills and no approval step: the external agent brings its own abilities and
runs the goal on its own platform. `has_knowledge_base` and `context_access` still work, and mean
something narrower here — what Wexa knows is gathered once and bundled into the goal handed over,
never live access back into your project. Poll the run with
[`get-execution`](/docs/tools/get-execution): a node like this can stay open for a long time, and
it can stop to ask a question.

## What it returns

The three surfaces wrap this differently, and code written against one will not read another
correctly — see [return shape](/docs/tools/overview#return-shape).

A real response, captured from a live call to `create-process-flow`:

**Result of create-process-flow**

**REST API**

```json
{
  "lifecycle_id": "qlc_000209",
  "result": {
    "flow": {
      "_id": "6ab196817566f41b5c28e33a",
      "agents": [],
      "anomaly_detection": {
        "instructions": "",
        "is_enabled": false
      },
      "created_at": 1790023297.679563,
      "cron_details": {
        "agentflow_id": "",
        "collection_name": null,
        "count": null,
        "executed_by": null,
        "filters": null,
        "frequency": "",
        "goal": {
          "display_template": "",
          "template": ""
        },
        "limit": null,
        "projectID": "",
        "query": {},
        "query_limit": null
      },
      "default_goal": "",
      "description": "Created to capture delete-process-flow, then deleted.",
      "failover_agentflow_ids": null,
      "image": "https://wexadevelopment.blob.core.windows.net/connectors/knowledge_base.jpeg",
      "isActive": true,
      "is_cron_scheduled": false,
      "is_deleted": false,
      "kind": "flow",
      "last_used": 1790023297.679572,
      "name": "docs-fixture-scratch-flow-1790023297678",
      "organization_id": "6a79a770b6c128ccc24bfca8",
      "projectID": "6aa9beb7ec8121a43b6c791b",
      "role": " ",
      "type": "master",
      "unique_id": "1cuikfo",
      "updated_at": 1790023297.679571
    },
    "process_flow_id": "6ab196817566f41b5c28e33a"
  }
}
```

**Wexa MCP server**

```json
{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000209\",\"result\":{\"flow\":{\"_id\":\"6ab196817566f41b5c28e33a\",\"agents\":[],\"anomaly_detection\":{\"instructions\":\"\",\"is_enabled\":false},\"created_at\":1790023297.679563,\"cron_details\":{\"agentflow_id\":\"\",\"collection_name\":null,\"count\":null,\"executed_by\":null,\"filters\":null,\"frequency\":\"\",\"goal\":{\"display_template\":\"\",\"template\":\"\"},\"limit\":null,\"projectID\":\"\",\"query\":{},\"query_limit\":null},\"default_goal\":\"\",\"description\":\"Created to capture delete-process-flow, then deleted.\",\"failover_agentflow_ids\":null,\"image\":\"https://wexadevelopment.blob.core.windows.net/connectors/knowledge_base.jpeg\",\"isActive\":true,\"is_cron_scheduled\":false,\"is_deleted\":false,\"kind\":\"flow\",\"last_used\":1790023297.679572,\"name\":\"docs-fixture-scratch-flow-1790023297678\",\"organization_id\":\"6a79a770b6c128ccc24bfca8\",\"projectID\":\"6aa9beb7ec8121a43b6c791b\",\"role\":\" \",\"type\":\"master\",\"unique_id\":\"1cuikfo\",\"updated_at\":1790023297.679571},\"process_flow_id\":\"6ab196817566f41b5c28e33a\"}}"
    }
  ],
  "isError": false
}
```

**TypeScript SDK**

```ts
// the object you get back IS the result — there is no `.result` to read
{
  flow: {
    _id: '6ab196817566f41b5c28e33a',
    agents: [],
    anomaly_detection: {
      instructions: '',
      is_enabled: false
    },
    created_at: 1790023297.679563,
    cron_details: {
      agentflow_id: '',
      collection_name: null,
      count: null,
      executed_by: null,
      filters: null,
      frequency: '',
      goal: {
        display_template: '',
        template: ''
      },
      limit: null,
      projectID: '',
      query: {},
      query_limit: null
    },
    default_goal: '',
    description: 'Created to capture delete-process-flow, then deleted.',
    failover_agentflow_ids: null,
    image: 'https://wexadevelopment.blob.core.windows.net/connectors/knowledge_base.jpeg',
    isActive: true,
    is_cron_scheduled: false,
    is_deleted: false,
    kind: 'flow',
    last_used: 1790023297.679572,
    name: 'docs-fixture-scratch-flow-1790023297678',
    organization_id: '6a79a770b6c128ccc24bfca8',
    projectID: '6aa9beb7ec8121a43b6c791b',
    role: ' ',
    type: 'master',
    unique_id: '1cuikfo',
    updated_at: 1790023297.679571
  },
  process_flow_id: '6ab196817566f41b5c28e33a'
}

// The TS SDK names these camelCase — lifecycleId, traceId — where Python uses
// lifecycle_id and trace_id. Both are non-enumerable: readable, but omitted by
// Object.keys() and JSON.stringify(). `result.lifecycleId` here is undefined.
result.lifecycleId // 'qlc_000209'
```

**Python SDK**

```python
# a dict subclass; `result` is already unwrapped
{
 "flow": {
  "_id": "6ab196817566f41b5c28e33a",
  "agents": [],
  "anomaly_detection": {
   "instructions": "",
   "is_enabled": False
  },
  "created_at": 1790023297.679563,
  "cron_details": {
   "agentflow_id": "",
   "collection_name": None,
   "count": None,
   "executed_by": None,
   "filters": None,
   "frequency": "",
   "goal": {
    "display_template": "",
    "template": ""
   },
   "limit": None,
   "projectID": "",
   "query": {},
   "query_limit": None
  },
  "default_goal": "",
  "description": "Created to capture delete-process-flow, then deleted.",
  "failover_agentflow_ids": None,
  "image": "https://wexadevelopment.blob.core.windows.net/connectors/knowledge_base.jpeg",
  "isActive": True,
  "is_cron_scheduled": False,
  "is_deleted": False,
  "kind": "flow",
  "last_used": 1790023297.679572,
  "name": "docs-fixture-scratch-flow-1790023297678",
  "organization_id": "6a79a770b6c128ccc24bfca8",
  "projectID": "6aa9beb7ec8121a43b6c791b",
  "role": " ",
  "type": "master",
  "unique_id": "1cuikfo",
  "updated_at": 1790023297.679571
 },
 "process_flow_id": "6ab196817566f41b5c28e33a"
}

out.lifecycle_id  # 'qlc_000209' — an attribute, not a key
```

Keeping the `lifecycle_id` is what lets you ask later why a call was allowed, refused or held.

## Calling it

The same call on all four surfaces. Pick a tab once and every code block in the documentation follows it.

The ids in this example are real: they resolve against the project the documentation is written
against, so the call runs as written once you point it at your own deployment. Swap them for the
ids of your own objects.

**Call create-process-flow**

**Wexa MCP server**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "create-process-flow",
    "arguments": {
      "name": "orders-triage", "description": "Triage incoming orders."
    }
  }
}
```

**REST API**

```bash
curl -sS https://fabric.wexa.ai/v1/create-process-flow \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "content-type: application/json" \
  -d '{"name":"orders-triage","description":"Triage incoming orders."}'
```

**TypeScript SDK**

```ts
import { Fabric } from '@wexa-fabric/sdk'

const fabric = new Fabric()
const { result } = await fabric.createProcessFlow({
  name: 'orders-triage',
  description: 'Triage incoming orders.'
})
```

**Python SDK**

```python
from wexa import Fabric

fabric = Fabric()
out = fabric.create_process_flow(name="orders-triage", description="Triage incoming orders.")
```

## Errors

Both SDKs raise the same typed errors, chosen from the gateway's own error string first and its
HTTP status second. `create-process-flow` checks the `fabric:orchestrate.write` grant, and reaches the seven classes every
tool reaches — listed under [the common set](/docs/tools/errors#the-common-set). These are the ones specific to it:

| Error | Status | Raised when |
| --- | --- | --- |
| `ApprovalRequired` | 202 | A policy held this call for a person to approve. The error carries the approval id; see below. |
| `ConfigurationError` | 5xx | `create-process-flow` is not available to you. Retrying will not help. |

## Governance

Every call to `create-process-flow` runs through the same ten-stage lifecycle as every other Wexa tool: the
credential is resolved to a scope, the `fabric:orchestrate.write` grant is checked, quota is drawn down, the arguments are
validated, policy rules are evaluated, the call is executed, the result is shaped and redacted, and an audit
record is written. The `lifecycle_id` in the response is the handle to that record.

`create-process-flow` is marked consequential, which means it changes something rather than only reading. Two things
follow. It is audited in full rather than lightly, and a policy rule may hold it for human approval — in which
case the call returns `202` and an `ApprovalRequired` error carrying the approval id, and the SDKs can wait for
the decision and resume rather than making you call again.

## See also

[The tool index](/docs/tools/overview), [errors](/docs/tools/errors),
and [which identifier goes where](/docs/tools/identifiers).
