// docs / ai assistant

AI assistant

A Claude-backed assistant lives in the in-editor toolbar. It can answer questions about the active flow, and it can change the flow directly through a single tool call. The model's edits land on the canvas live as it commits to them.

Enabling it

Set an Anthropic API key. Two equivalent ways:

  • Add ANTHROPIC_API_KEY=… to /opt/openflow/.env and restart the manager.
  • Or, as platform admin, paste it into the Settings tab. The DB-stored value overrides the env var; useful for rotating without a manager restart.

The assistant button (a small ✦ icon in the editor's top toolbar) appears once a key is configured. Without a key, the button is hidden.

What it does

Two things, one tool:

  • Answers questions about Node-RED and about the active flow tab. The model has the full JSON of the active tab in its context, so it can reason about specific nodes, wires, and configuration.
  • Calls apply_flow_changes to add new nodes, edit existing nodes (props, wires, enable/disable), or delete nodes.

When it calls the tool, the toolbar applies the patch to the live canvas. Nothing is deployed: nodes appear, wires connect, but the change is uncommitted until you click Node-RED's Deploy button. Reverting is a Ctrl-Z away, just like any other edit.

Streamed application

The model's add array is streamed: as each new node's JSON is complete in the partial tool input, the toolbar draws it immediately. You see nodes appear one by one as the model commits, rather than a silent pause followed by ten nodes appearing all at once.

Placement is anchored off the active canvas: the first new node lands to the right of existing content with a generous gutter, subsequent nodes wrap into a 4-column grid relative to that origin. The next assistant turn re-anchors off whatever the canvas looks like after the previous turn's edits, so two consecutive prompts don't stack on top of each other.

Privacy & data

The assistant sends three things to Anthropic on every turn:

  • The conversation history (user messages + the model's prior replies).
  • The full JSON of the active flow tab, as the editor-context message.
  • The system prompt and the tool schema.

Encrypted credentials in flows_cred.json are not sent. Plaintext values in node configuration (e.g. a non-credential URL) are. If you'd rather not send any of that, leave the key unset.

Conversations are stored on the instance in the ai_conversations and ai_messages tables for replay, and the dashboard's AI Chat tab shows the history per instance.

Turning it off

  • Per platform: clear ANTHROPIC_API_KEY from .env AND the Settings tab, restart. The assistant button disappears.
  • Per instance: there's no current per-instance toggle. If you want one, open a discussion on the repo.