Generate a BRAND-NEW Lamina app from a plain-language instruction, OR EDIT an existing generated app in place. Use this when NO existing app fits the goal (check `lamina_discover` first) and the user wants a bespoke workflow — or when a follow-up needs the app itself changed (add a step, new output, swap a model), not just a different run.
A headless Claude planner assembles a validated node graph from the Lamina node catalog and auto-publishes it as a PRIVATE, immediately-runnable app.
- `instruction`: describe what the app should create (or, in edit mode, the change to make), including the inputs the user will provide and the desired output(s).
- `baseAppId` (optional): EDIT MODE. The appId of a generated app to modify. The planner starts from its current graph and applies `instruction` as a targeted edit — keeping everything it does not touch — then updates that SAME app in place (same appId, run history preserved). Requires you to be the app creator or a workspace owner/admin. Omit to build a new app.
- `ops` (optional, EDIT MODE — the CHEAP path): when you already know the exact change and can express it as a small op list, pass `ops` instead of `instruction` — the server applies them deterministically with NO planner LLM call and no credit charge. Each op is one of: `{op:"setNodeData",nodeId,data}`, `{op:"addNode",node:{id,type,data?}}`, `{op:"removeNode",nodeId}`, `{op:"addEdge",edge:{source,target,sourceHandle?,targetHandle?}}`, `{op:"removeEdge",source,target}`, `{op:"addParameter",parameter:{key,name,type,targetNodeId,targetField,...}}`, `{op:"removeParameter",key}`, `{op:"setParameter",key,patch}`. Requires `baseAppId`. Read the app first (`lamina_describe`/`GET /v1/apps/{id}`) to get node ids. Use `instruction` (planner) for anything you cannot express as ops.
- `name` (optional): preferred app name.
- `visibility` (optional): `private` (default), `shared` (whole workspace), or `public`. Ignored in edit mode.
- `brandProfileId` (optional): bake a brand's voice/visual/guardrails into the app so it's on-brand by default. Omit to use the workspace's active brand.
- Returns `{ appId, name, parameters[], outputs[], runUrl }`. In edit mode `appId` is unchanged. Feed `appId` + the returned parameter `key`s straight into `lamina_run` — the parameter set may have changed, so re-read `parameters[]`.
- On failure returns `{ error, details[] }` where details are the validation problems the planner could not resolve.