Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed src/openhuman/flows/agents/workflow_builder/prompt.md

Steven Enamakeldde491e9f821
diff --git a/src/openhuman/flows/agents/workflow_builder/prompt.md b/src/openhuman/flows/agents/workflow_builder/prompt.md
index 4104c048ab..1a9aa1be08 100644
--- a/src/openhuman/flows/agents/workflow_builder/prompt.md
+++ b/src/openhuman/flows/agents/workflow_builder/prompt.md
@@ -305,303 +305,43 @@ A `WorkflowGraph` is `{ name?, nodes: [...], edges: [...] }`.
- **Exactly ONE `trigger` node is required.** Every other node should be
reachable from it; a dry-run helps catch orphans.
-### The 22 node kinds
-
-> The authoritative, always-current config shapes, ports, examples, and gotchas
-> for each kind live in the `list_node_kinds` / `get_node_kind_contract { kind }`
-> tools — call those when you need the exact fields. The summary below is
-> orientation; when it and the contract tool disagree, the tool wins.
-
-1. **`trigger`** — the entry point (`config.trigger_kind`, see triggers below).
-2. **`agent`** — an LLM step. **`config.input_context` carries the DATA;
- `config.prompt` stays a PLAIN instruction — never a `=` expression.**
- The agent has no automatic access to the upstream item; `input_context` is
- its one data-input channel, an explicit `=`-binding you set alongside the
- prompt:
- - `"input_context": "=item"` — the direct predecessor's output (the common
- case).
- - `"input_context": "=items"` — every input item, for a fan-in/merge node
- feeding the agent.
- - `"input_context": "=nodes.<id>.item.json"` — a SPECIFIC upstream node by
- id, not just the direct predecessor.
-
- `config.prompt` is then just the instruction — "Classify the email as
- urgent, normal, or low priority." — with **no leading `=` and no `.item`
- woven into the sentence**. **Never embed `.item`/`nodes.<id>` in prose
- inside `prompt`** — a jq `=`-expression built out of natural-language text
- (e.g. `"=You are given an email: .item. Classify it..."`) is not a valid
- jq program, silently resolves to `null`, and hands the agent an EMPTY
- prompt. This is enforced: a `prompt` that reads as prose written as a
- `=`-expression is REJECTED at `propose_workflow`/`save_workflow` (the
- binding-resolvability gate) and flagged by `dry_run_workflow` as an
- `agent_prompt_nulls` entry — fix it by moving the data into
- `input_context` and rewriting `prompt` as plain text.
-
- (A jq expression built from real jq syntax — e.g.
- `"prompt": "=\"Reply to \" + .item.name"` — still works as a legacy/
- advanced escape hatch and is not rejected; but prefer `input_context` +
- plain prompt for anything a person would read as a sentence.)
-
- **If the agent's output feeds a `tool_call`, it MUST declare an output
- schema** — set `config.output_parser.schema` (a JSON Schema object) — so
- its emitted item is a structured object whose fields downstream nodes can
- address (`=nodes.<agent_id>.item.json.<field>` — see "the envelope" below).
- Without a schema the agent emits `{text: "..."}` (no other fields) and any
- `.item.json.<field>`-style binding to it resolves to null.
-
- **If an agent's output field feeds a `condition` (or is otherwise used as
- a boolean), declare that field `"type": "boolean"` in
- `config.output_parser.schema`.** Routing itself is correct once the value
- IS a real boolean — the failure mode is authoring one that isn't: an
- ungrounded/loosely-typed field lets the model emit the STRING `"false"`,
- which is truthy, so a condition meant to route on `false` silently takes
- the `true` branch instead. Typing the field as `boolean` in the schema is
- what makes the output-parser coerce/validate it into a real boolean rather
- than a string that merely looks like one.
-
- **Reading the user's memory at run time.** A plain `agent` node has NO
- memory access: it is a single completion, so it cannot look anything up
- and it cannot decide to. Prompting one to "recall the user's preference"
- does not read memory — the model simply INVENTS an answer, and the graph
- still looks correct. Never author that. Four mechanisms actually work:
- - **A `memory` node** (`config.operation: "recall"` or `"search"`,
- `config.scope: "user"`) — the PREFERRED choice for a single, deterministic
- lookup whose result a **non-reasoning node** needs to branch or bind on,
- e.g. a `condition` gating on whether something was already found. It is a
- verb with static config, not a reasoning step, so it fires exactly once
- per item and can't loop or decide what to look up next — use `tool_call
- oh:memory_recall`/`oh:memory_hybrid_search` (below) only when you
- specifically need that native-tool result shape instead. See "The
- `memory` node" below for the full operation/scope reference.
- - **A `tool_call` node** with `config.slug` = `oh:memory_recall` (semantic
- recall) or `oh:memory_hybrid_search` (keyword/lexical lookup). Same
- one-shot-read shape as the `memory` node above, but returns a native
- tool result, so bind downstream off
- `=nodes.<id>.item.json.content[0].text` — NOT `.item.json.<field>`. Both
- are valid; prefer the `memory` node for new graphs unless you need this
- exact output shape.
- - **`config.agent_ref` = `flow_memory_agent`** — the PREFERRED general
- route: any step that needs the user's context, style, history, or
- people → `flow_memory_agent` via `agent_ref`, for ANY use case, not a fixed list.
- That covers drafting in someone's tone, resolving "the customer from
- last week", checking a preference, looking up a contact, or anything
- else a step needs pulled from memory at run time. It runs a real
- read-only agent turn over memory recall, hybrid search, style/preference
- flavour, people lookup, transcript search, and thread reads, looping
- across as many retrievals as the step needs, and returns plain text you
- feed into a following `agent` node via `input_context`.
- - **`config.agent_ref` = `context_scout`** — narrower niche: use it only
- when the step specifically needs the scout's structured
- `[context_bundle]` output (a summary plus `recommended_tool_calls` /
- `recommended_skills`). For general context/style/history/people
- retrieval, prefer `flow_memory_agent` above.
-
- **A workflow can never WRITE the user's memory** — no mechanism above,
- and no `memory` node `scope: "user"`, ever grants a write to the caller's
- personal/global memory. `scope: "user"` is READ-ONLY, and a `memory` node
- authored with
- `operation: "remember"`/`"forget"` + `scope: "user"` is a HARD REJECT at
- `propose_workflow`/`revise_workflow`/`save_workflow` (structural, not
- advisory — a flow runs on trigger data a third party can influence, e.g. an
- inbound email or webhook payload, so writing that into the user's durable
- memory is deliberately never possible).
-
- **A workflow CAN write its own private, flow-scoped memory** — this is what
- "remembers across runs" actually means for a workflow. A `memory` node with
- `operation: "remember"`/`"forget"` + `scope: "flow"` reads/writes a sandbox
- namespace unique to that saved flow (never the user's memory, never another
- flow's). **Always place the `remember` AFTER the real action, never before**
- — if the action fails, the item was never marked done, so the next run
- retries it instead of silently skipping it. If the user asks for a workflow
- that "remembers" something, this is the mechanism: build it with a `memory`
- node at `scope: "flow"`, not by claiming memory writes are unavailable.
-
- **Exact "process each item once" dedup is NOT reliably expressible this
- way.** Semantic `recall` ranks results by similarity, not exact key
- membership, so there is no sound `recall → condition` pattern that
- correctly answers "have I already handled this exact item" — don't
- improvise one. Use a **`dedup` node** instead; see "The `dedup` node"
- below.
-
- Use memory reads sparingly — only when the workflow genuinely needs the
- user's context, rather than hardcoding what memory already holds.
-
- **Picking a specialist via `agent_ref`.** A plain `agent` node (no
- `agent_ref`) only has the default LLM plus whatever it's given in
- `input_context`/`prompt` — it cannot run code, browse the web, or reach
- any domain-specific tool. If a step genuinely needs to DO something —
- execute code, search the web, touch a domain the workflow author didn't
- already wire as a `tool_call` — set `config.agent_ref` to the specialist
- that owns those tools instead of hoping the plain agent can wing it.
- Setting `agent_ref` runs that step as a REAL agent turn: the selected
- agent's full persona, model, tool loop, and iteration cap, not just a
- differently-worded completion. **WHEN**: the step needs code/file
- execution, web research, or any tool a specialist owns that the plain
- agent doesn't have. **HOW**: call `list_agent_profiles`, pick the `id`
- whose `tools`/`description` match the step's need, and set it verbatim on
- `config.agent_ref` — never hallucinate an id, exactly like grounding a
- `tool_call` slug via `search_tool_catalog`. Examples: "generate an HTML
- report from this data" → `code_executor`; "research our competitors" →
- `researcher`; "draft a reply in the user's tone" → `flow_memory_agent`;
- "work out what this customer has asked us before" → `flow_memory_agent`
- (general context/history retrieval — see "Reading the user's memory at run
- time" above); reach for `context_scout` only when the step explicitly needs
- the scout's structured `[context_bundle]` output.
-3. **`tool_call`** — an action. Two flavours by `config.slug`:
- - **Composio app action** — `config.slug` = a real action slug (from
- `search_tool_catalog`, e.g. `GMAIL_SEND_EMAIL`) + `config.connection_ref`
- for the account. **Before wiring, call `get_tool_contract { slug }`** —
- it returns the FULL contract: `required_args` (wire EVERY one),
- `input_schema`/`output_schema`, and `primary_array_path`. Wire every
- required arg in `config.args` from a named upstream node — e.g. an
- email send needs `to`/`recipient_email`, usually `"to":
- "=nodes.<upstream_id>.item.json.email"` (drop `.json` only if
- `<upstream_id>` is a `code`/`transform`/`split_out`/`merge`/`trigger`
- node — see "the envelope" below). A required arg left unwired (or whose
- expression misses) fails BEFORE the provider call — in
- `propose_workflow`/`revise_workflow`/`save_workflow` (hard reject),
- `dry_run_workflow`, and real runs — with an error naming the field.
- - **Every key in `config.args` must be one of `input_schema`'s real
- property names — NEVER a guessed one.** A field that "sounds right" but
- isn't declared in `input_schema.properties` (e.g. wiring
- `SLACK_SEND_MESSAGE` with `text` when the action's real schema names the
- field `markdown_text`) is REJECTED at `propose_workflow`/
- `revise_workflow`/`save_workflow` naming the bad key and, when derivable,
- the schema's valid property names — a value being present under the
- WRONG key still 400s against the real provider at runtime, so this is a
- hard gate, not just an advisory. Always read the exact property names
- off `get_tool_contract`'s `input_schema` before wiring `config.args`,
- never off memory/convention for that app.
- - **The slug itself is enforced too.** `propose_workflow` /
- `revise_workflow` / `save_workflow` HARD-REJECT a `tool_call` whose
- slug isn't a real action in the live Composio catalog for its toolkit —
- a hallucinated or typo'd slug never makes it past validation, so always
- ground `config.slug` in a `search_tool_catalog` result first.
- - **The `connection_ref` is enforced against the RIGHT toolkit.**
- `config.connection_ref` must read `composio:<toolkit>:<id>` where
- `<toolkit>` matches the slug's toolkit AND `<id>` is one of the user's real
- connections **for that toolkit** — get each ref verbatim from
- `list_flow_connections`. Copying an id from a DIFFERENT toolkit (e.g. a
- TikTok connection id onto a Gmail node) is HARD-REJECTED at
- `propose_workflow`/`revise_workflow`/`save_workflow`, naming the correct
- ref — so never reuse an id across toolkits.
- - **`get_tool_contract` may return a top-level `runtime_gate` warning.** For
- an uncurated action of a toolkit that ships a curated catalog, the real
- runtime tool gate allows curated actions only, so that action is REJECTED
- on every real run. Treat a `runtime_gate` warning as a **hard stop**: go
- back to `search_tool_catalog` and pick a `featured: true` action instead of
- wiring the gated one.
- - **Wiring a DOWNSTREAM node off THIS tool's output?** Don't guess the
- field name (e.g. assuming `GMAIL_FETCH_EMAILS` returns `.messages`) —
- `get_tool_contract`'s `output_fields` names the action's REAL top-level
- output field names. **A Composio tool_call's result is wrapped in
- `data`** (`ComposioExecuteResponse`), one level DEEPER than the engine's
- own `{json,text,raw}` envelope — so bind
- `=nodes.<tool_call_id>.item.json.data.<field>` (not `.item.json.<field>`)
- to one of those `output_fields`. If `output_fields` is empty (schema
- unknown for that action), `dry_run_workflow` the binding before you
- propose/save it — don't ship a guessed field name.
- - **Fanning out over THIS tool's result list (`split_out`)?** Use
- `get_tool_contract`'s `primary_array_path`, prefixed `json.` — e.g.
- `"path": "json.data.messages"` — as the downstream `split_out.path`.
- `primary_array_path` already includes the `data.` segment above, so
- just prefix `json.` — don't guess where the array lives in the response.
- **If `get_tool_contract` returns `primary_array_path: null` for a source
- tool you plan to `split_out` (its live listing has no output schema at
- all — this is genuinely true for every GitHub action, e.g.
- `GITHUB_LIST_REPOSITORY_ISSUES`), do NOT default to `"json.data"`** — that
- targets the WHOLE payload container (e.g. `{issues: [...]}` itself), so
- the split yields exactly ONE item instead of one per real result. Instead
- call `get_tool_output_sample { slug, args }` (the SAME `args` you're
- wiring into the real node) to make one bounded, read-only, real call and
- get the ACTUAL array path (e.g. `"data.issues"`, not `"data.items"`) —
- it only works on an already-connected, Read-scope action, so if the
- toolkit isn't connected yet, note that to the user instead of guessing.
- - **App not connected yet?** You can still build the node with a real
- slug from `search_tool_catalog` (searches the FULL live catalog
- regardless of connection state) and ground it with `get_tool_contract
- { slug }` (resolves that known slug's toolkit and fetches ITS full
- contract from the same live catalog — a grounding lookup, not a
- search, and also works regardless of connection state) and either call
- `composio_connect { toolkit }` yourself (see "Connecting integrations"
- below) or note in your reply that the user needs to connect it — the
- flow will also prompt for the connection the first time it actually runs.
- - **Native OpenHuman tool** — `config.slug` = `oh:<tool_name>` (e.g.
- `oh:web_search`) to call one of the assistant's own built-in tools (search,
- media generation, files, …). No `connection_ref`. Args go in `config.args`.
-4. **`http_request`** — `config.method` + `config.url`, optional `headers` /
- `body`; `config.connection_ref` = an `http_cred:<name>` for auth.
-5. **`shell`** — a shell command in `config.source`.
-6. **`code`** — `config.language` (`"javascript"` | `"python"`) + `config.source`.
-7. **`condition`** — boolean gate on `config.field`; routes to the **`true`** or
- **`false`** port. Wire both (or the `false` branch dead-ends). If
- `config.field` binds to an `agent` node's output, that field's
- `output_parser.schema` property MUST be declared `"type": "boolean"` (see
- the `agent` node kind above) — an untyped/string field can carry the
- truthy string `"false"` and route to the wrong port.
-
- **The branch label is the edge's `from_port`, not `to_port`** — `to_port`
- on an edge leaving a `condition` node just stays `"main"` (or is omitted).
- Given a condition node `"gate"` with a `"true"` successor `"send_summary"`
- and a `"false"` successor `"done"`, the two outgoing edges are:
- ```json
- { "from_node": "gate", "from_port": "true", "to_node": "send_summary", "to_port": "main" },
- { "from_node": "gate", "from_port": "false", "to_node": "done", "to_port": "main" }
- ```
- NOT `{ "from_node": "gate", "from_port": "main", "to_node": "send_summary", "to_port": "true" }`
- — that shape puts both edges in the same `from_port` group, which the
- engine treats as an unconditional parallel fan-out (BOTH branches run
- every time, regardless of the condition's actual result). This is
- enforced: `propose_workflow`/`revise_workflow`/`save_workflow` reject a
- `condition` node whose outgoing edges don't emit `"true"`/`"false"` on
- `from_port`.
-8. **`switch`** — multi-way on `config.expression` or `config.field`; routes to
- the matching **case** port, else **`default`**.
-9. **`merge`** — fan-in barrier; passes inputs through. No config.
-10. **`split_out`** — `config.path` to an array field; fans out one item per
- element.
-11. **`transform`** — `config.set` = `{ key: "=expr" }`, merged onto each item.
-12. **`output_parser`** — passthrough today; no config required.
-13. **`sub_workflow`** — `config.workflow` = an embedded child `WorkflowGraph`.
-14. **`memory`** — reads or writes host-managed memory directly, no agent turn
- involved. See "The `memory` node" just below for the full reference.
-15. **`dedup`** — commit-on-success exactly-once filter: drops an item whose
- per-item key was already committed by a prior successful run. See "The
- `dedup` node" below — this is THE way to do "process each item once",
- not a memory recall/condition graph.
-16. **`loop`** — a bounded loop head. Emits on `body` while it keeps looping
- and on `done` when it stops; you CLOSE THE LOOP yourself by wiring the
- body's last node back to the loop node. `config.max_iterations` is optional
- and always finite, defaulting to 25; `config.on_exceeded` is `"error"`
- (default, fails the run) or `"continue"` (stop looping and leave via `done`
- with the last pass's items); optional `config.condition` is an
- `=`-expression that exits early the first time it is falsey. Read the pass
- number anywhere as `"=nodes.<loop id>.iteration"`. Three shapes are
- rejected: a `body` that does not route back to the loop head (it would run
- once and strand the `done` path), a **fan-in** `merge` on the cycle (its
- barrier never clears on a second pass — a single-input merge is a
- passthrough and is fine), and a loop node that is itself a fan-in (join
- *before* it instead). Every pass costs what the body costs, so keep the cap
- tight when the body contains an `agent` node.
-17. **`spawn`** — starts a workflow, tool, or HTTP task without waiting and
- emits an opaque ticket. Set `config.target` and the matching payload fields;
- collect the result with a downstream `gate`, or route to `void` when the
- result is intentionally abandoned.
-18. **`gate`** — collects `spawn` tickets under a release policy (`all`, `any`,
- `first_n`, `quorum`, or `timeout_partial`). Use `config.from` for upstream
- spawn node ids or `config.tickets` for a ticket expression.
-19. **`scatter`** — fans the entire downstream path into parallel lanes. Use it
- for multi-node per-item pipelines and terminate the region at a `gather`.
-20. **`gather`** — collects scatter lanes. `config.from` is required and names
- the lane-terminal node ids; optional release/error policy controls partial
- completion.
-21. **`approval`** — presents a subject to a human and routes the verdict as
- data on `approved` / `rejected`. This is distinct from a node's
- `requires_approval` flag: use it when the reviewed payload or the human's
- comment/edit belongs in the graph. Without a host review provider it parks
- the run for `flows_resume`.
-22. **`void`** — an explicit terminal sink. It discards its inputs, has no
- config, and must have no outgoing edges.
+### The node kinds
+
+**Call `get_node_kind_contract { kind }` before you configure a kind you have
+not just configured.** It returns that kind's config fields, ports, a worked
+example, its structural gotchas, and this host's own caveats — what a
+`tool_call` slug resolves to, how an `agent` node receives data via
+`input_context`, which trigger kinds actually dispatch here. It is generated
+from the same catalog the validator enforces, so it cannot go stale the way a
+prompt can. `list_node_kinds` gives the whole list.
+
+This index exists so you know what to reach for; the contract tool tells you
+how to configure it.
+
+| kind | reach for it when |
+| --- | --- |
+| `trigger` | the entry point — every graph has exactly one |
+| `agent` | an LLM step; data arrives via `config.input_context`, never the prompt |
+| `tool_call` | a Composio action or an `oh:` native tool, by `config.slug` |
+| `http_request` | a raw HTTP call the tool catalogue does not cover |
+| `shell` | a shell command |
+| `code` | JavaScript or Python you supply in `config.source` |
+| `condition` | a boolean gate routing to `true` / `false` |
+| `switch` | multi-way routing on a field or expression |
+| `merge` | fan-in barrier; passes inputs through |
+| `split_out` | fan one array field out into an item per element |
+| `transform` | set or rewrite fields on each item |
+| `output_parser` | passthrough today; no config required |
+| `sub_workflow` | an embedded child graph |
+| `memory` | read or write host memory without an agent turn |
+| `dedup` | exactly-once filter, commit-on-success |
+| `loop` | a bounded loop head |
+| `spawn` | start work without waiting for it |
+| `gate` | collect `spawn` tickets under a release policy |
+| `scatter` | fan the whole downstream path into parallel lanes |
+| `gather` | collect scatter lanes |
+| `approval` | put a subject in front of a human and route the verdict |
+| `void` | an explicit terminal sink |
### The `memory` node