# Wingman, the workflow assistant

Describe a workflow in plain language and Wingman builds or changes the graph, validates it with the editor's own pipeline and saves it as an undoable revision.

Source: https://glamorous-boar.cloudvent.net/wingman/

---

**Wingman** is AgenticMind's built-in assistant for building graphs. You describe what you want; it proposes a complete graph using the real node catalog, the platform validates the proposal, and if it is valid it is saved as the next revision of the project with an **Undo** button.

## How to use it

1. Open a project (or click **New blank project** inside Wingman).
2. Click the round ✨ **Build with Wingman** button in the bottom-right corner.
3. Describe the workflow. Be specific about inputs, steps and outputs:
   - *Take any question and answer it yes or no.*
   - *Classify the customer's message as billing, technical or other, redact personal data before the model sees it, then answer with an LLM.*
   - *Add a step that translates the answer into French.*
   - *Replace the retriever with hybrid search and add a reranker.*
4. Wingman replies in Markdown, lists the change (nodes added, changed and removed; connections added and removed) and applies it as a new revision.
5. Run it, or ask in **Chat**. If it is not what you meant, press **Undo** (which saves the previous graph as yet another revision, so nothing is lost) or ask for a change.

You can also ask questions without changing anything: *What does the Reranker do?* or *Why is my graph failing?*

## How it works

<Diagram caption="The model proposes, the platform decides.">

```
sequenceDiagram
  participant U as You
  participant W as Wingman (IDE)
  participant A as API /assistant
  participant M as Model
  participant V as Validator
  U->>W: Describe the workflow
  W->>A: request + current canvas + last 12 turns
  A->>M: IR rules + node catalog + canvas + request
  M-->>A: reply + complete proposed graph
  A->>V: parse as IR, validate_project
  alt blocking diagnostics
    A->>M: diagnostics, try again (up to 3 rounds)
  end
  A-->>W: reply, diff, remaining problems
  W->>W: save as next revision, offer Undo
```

</Diagram>

- **Context sent to the model:** the rules of IR v1, a compact catalog of the newest *permitted* version of every node (ports, branches, config keys, enums, defaults, limits; unapproved plugin nodes are excluded), the current canvas (even unsaved) and the last 12 chat turns.
- **Whole-graph proposals.** The model returns `{reply, change}` where `change` is the complete resulting graph (or null). This is simpler and more reliable for a model than patch operations. The server computes the diff.
- **Validated with the editor's own pipeline.** Blocking diagnostics are sent back to the model to repair, up to 3 attempts (configurable 1–5). Environment notes such as `SECRET_NOT_CONFIGURED` never block.
- **Normalisation.** Existing node positions are kept; new nodes are laid out in columns by graph depth. `max_tokens` below 512 is raised, because reasoning models need room to think.
- **Secrets stay references.** Generated LLM nodes reference secrets by name only.
- **The endpoint never saves.** The IDE saves a valid proposal; a proposal that still has errors is shown with its problems and can be applied explicitly as a draft.

## Configuring the model

By default Wingman uses OpenRouter with `google/gemini-3.8-flash` and the `OPENROUTER_API_KEY` secret.

- **In the IDE (admins):** avatar → **Settings** → **Wingman**: provider, model (**Browse** lists the provider's models), API key *secret name*, base URL and repair attempts. **Test connection** sends one short request with the unsaved values. **Reset** removes the override.
- **With environment variables:** `AGENTICMIND_ASSISTANT_PROVIDER`, `AGENTICMIND_ASSISTANT_MODEL`, `AGENTICMIND_ASSISTANT_API_KEY_SECRET`, `AGENTICMIND_ASSISTANT_BASE_URL`. A saved setting overrides them.

Any of the 15 providers works, including local Ollama, but larger models build better graphs.

## Tips for good results

- Name the inputs and outputs you want (*an input called `ticket`, an output called `reply`*).
- Mention specific nodes when you know them (*use the Reranker*, *use a Router in rules mode*).
- Build in steps: a working skeleton first, then *add…* requests.
- Check the result in **Problems** and with a test run. Validity is structural: a valid graph may still not do what you meant. The reply, the diff, Undo and the [Evaluation Lab](/evaluation/) are your safeguards.

## Cost and limits

Each request costs roughly 10–25k tokens (the catalog is about 30 KB of text), plus repairs. Replies carry the whole graph, which suits small and medium graphs; very large graphs would need patch operations. Chat threads are kept per project for the browser session.

## API

`POST /api/projects/{id}/assistant` with the message, the current canvas and history; `GET /api/assistant` reports the configured model and whether its key is set (never the value). See [REST API](/api/#wingman).
