# AI··Task: A simple guide

import { Steps } from "@astrojs/starlight/components"

An **AI··Task** is a built-in flow step that sends a prompt to a large language model (LLM) and returns text or
structured output for later steps. You can attach integration tools so the model calls APIs during the run, and you can
share conversation memory across AI··Tasks in the same flow. Screenshots on this page use an IT incident report job so
you can see a filled prompt, model choice, tools, and memory settings.

## When to use

- You need the model to draft, classify, summarize, or structure data in the middle of a flow.
- You want the model to choose and call integration operations (for example VirusTotal or Google Workspace) from a
  curated tool list.
- Prefer [AI··Task: Prompt guidelines](../ai-task-prompt-guidelines/) when you already know how to add the step and need
  prompt structure only.
- Prefer [Use AI··Agent](../use-ai-agent/) when another Flowhook-based flow should be callable as an agent tool.
- Prefer [AI··Swarms](../ai-swarms-multi-agent-orchestration/) when several specialized AI··Agents must collaborate under
  one orchestrator.

Before you begin, open a flow in the designer where you can edit steps. AI features must be available for your
organization. For tool use, enable the target integrations and create credentials in the environment.

## Guide

### Add an AI··Task

AI··Task lives under **Built in** in the Add a step menu. After you add it, rename the step so later steps and logs are
easy to read.

<ol>
<li>

**Open Add a step.** In the designer, choose **Add a step** (or the **+** on the canvas).

</li>
<li>

**Choose AI··Task.** Under **Built in**, select **AI··Task**.

<div class="docs-screenshot-compact">

![Add a step menu with Built in listing AI··Task among other built-in steps](./assets/add-step-menu-built-listing-ai.png)

</div>

</li>
<li>

**Rename the step.** Open the step card and set a clear title for the job (for example **Reason and act** or **Draft
incident report**).

</li>
</ol>
### Write the prompt

On the **Input** tab, the optional **Input** field is the task and the data the model works on. Optional
**Instructions** (when shown for your organization) set standing role and behavior rules; those instructions are not
stored in memory. Both fields use Studio’s **rich text editor**: headings, lists, and emphasis render while you type,
and the stored value stays markdown for the model.

<ol>
<li>

**Open Input.** Select the AI··Task, then open the **Input** tab.

</li>
<li>

**Write the prompt.** Describe the role, what to do, which data to use (pick variables with `/` in **Input**), and the
result shape. Use headings (type `#` then Space), lists, and bold so the structure is easy to scan. For structure
patterns, see [AI··Task: Prompt guidelines](../ai-task-prompt-guidelines/).

```markdown title="Input"
# Role

You are an IT incident management specialist.

# Instructions

- Generate a formal IT incident report based **only** on the data provided.
- Keep a neutral, professional tone.

# Resources

incident: /incident

# Result

A well structured markdown report.
```

<div class="docs-screenshot-compact">

![AI··Task Input tab with GPT-5.2 selected and a structured incident report prompt in the rich text editor](./assets/ai-task-input-tab-gpt-4.png)

</div>

</li>
<li>

**Switch editor mode when needed.** On the field header, use **Edit as raw markdown** to edit the stored markdown
source, or **Edit as rich text** to return to the formatted view. Use the expand control when the prompt is larger than
the inspector allows.

<div class="docs-screenshot-compact">

![AI··Task Input field in raw markdown source mode with Edit as rich text control visible](./assets/ai-task-input-raw-markdown.png)

</div>

</li>
<li>

**Check the token estimate.** Use the token counter on the Input tab when you need a rough size for model choice or
prompt length.

<div class="docs-screenshot-compact">

![AI··Task Input tab token counter in the bottom right of the prompt area](./assets/ai-task-input-tab-token-counter.png)

</div>

</li>
</ol>
### Choose a model

Pick the model that powers the AI··Task from **Input** or **Settings**. Models that support tool calling show a
**Tools** tag in the model list. Parameters such as temperature, top-p, and output format depend on the selected model.

<ol>
<li>

**Open the model picker.** On **Input** or **Settings**, open the **Model** field.

</li>
<li>

**Select a model.** Prefer a tools-capable model when the step will use the **Tools** or **Agents** tab.

<div class="docs-screenshot-compact">

![AI··Task model picker open with provider models and a Tools tag on capable models](./assets/ai-task-model-picker-open-provider.png)

</div>

</li>
<li>

**Tune parameters when needed.** Adjust temperature, top-p, penalties, or **Output format** for the job. Lower
temperature usually means more deterministic answers; higher values allow more variation. Set **Output format** to
**JSON** when a later step must parse fields from the result — see
[AI··Task: Prompt guidelines](../ai-task-prompt-guidelines/).

</li>
</ol>
### Add integration tools

On the **Tools** tab, attach services from Mindflow’s catalog, bind a credential, and allow only the operations the
model may call. The model decides when to call a tool, fills parameters, then continues from the tool response. Run
**Logs** show each tool request and response.

<ol>
<li>

**Open Tools.** Select the AI··Task, then open the **Tools** tab.

</li>
<li>

**Add a service.** Choose the integration, pick a credential in the environment, then allow the operations the model may
use.

</li>
<li>

**Run and inspect Logs.** After a run, open **Logs** on the AI··Task to see tool calls, generated requests, and API
responses.

<div class="docs-screenshot-compact">

![AI··Task Logs showing tool calls during an investigation-style run](./assets/ai-task-logs-showing-tool-calls.png)

</div>
<div class="docs-screenshot-compact">

![Detail of a single tool call with generated request and API response](./assets/detail-single-tool-call-generated-request.png)

</div>

</li>
</ol>
### Configure memory

**Memory** lets several AI··Tasks share one conversation thread in a flow run (and, with a stable memory ID, across runs
inside the retention window). Configure it on **Settings**.

| Mode                     | What it does                                                                                        | Typical use                                  |
| ------------------------ | --------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| **None**                 | No thread; later steps cannot read this step’s messages.                                            | Stateless format or extract jobs             |
| **New Memory**           | Starts an empty thread and can write into it for later steps.                                       | First AI··Task in a chain                    |
| **Previous Step Memory** | Reads (and optionally appends to) the previous AI··Task’s memory. If append is off, the step forks. | Chained reasoning in one run                 |
| **Advanced**             | Sets a **Memory ID** and whether to append.                                                         | Branch from a specific thread or share by ID |

For **Previous Step Memory** and **Advanced**, **Append AI··Task job to memory** controls whether this step writes into
the same thread or forks a new one.

<ol>
<li>

**Open Settings.** Select the AI··Task, then open **Settings**.

</li>
<li>

**Choose a Mode.** Pick **None**, **New Memory**, **Previous Step Memory**, or **Advanced**.

<div class="docs-screenshot-compact">

![AI··Task Settings memory mode set to Advanced with Memory ID and Append AI··Task job to memory](./assets/ai-task-settings-memory-mode-set.png)

</div>

</li>
<li>

**Set Advanced fields when needed.** For **Advanced**, enter the **Memory ID**. Turn **Append AI··Task job to memory**
on to write into that thread, or off to read without appending (fork behavior on Previous Step Memory).

</li>
</ol>
:::note
**Previous Step Memory** is resolved at run time. If you run that step alone in the designer, its input memory is empty.
Isolated step runs also do not append to memory, so build-time tests do not poison a shared thread.
:::

## Example

An IT team drafts a formal incident report from structured incident data, then later chains investigation steps that
share memory.

1. **Add AI··Task.** Create a flow, add **AI··Task**, and rename it for the report job.
2. **Paste the incident prompt.** Use the `#Role` / `#Instructions` / `#Resources` / `#Result` prompt above, and pick
   the incident variable under `#Resources`.
3. **Pick a model.** Choose a tools-capable model if the same flow later adds VirusTotal or Workspace tools.
4. **Chain memory when needed.** On a follow-up AI··Task, set **Previous Step Memory** with append on so the second
   step sees the first report thread.

<details>
<summary>Memory chain across three AI··Tasks</summary>

In one flow:

<ol>
<li>

Step 1 uses **New Memory** and writes into `memory1`.

<div class="docs-screenshot-compact">

![First AI··Task memory log writing user and assistant messages into a new thread](./assets/first-ai-task-memory-log-writing.png)

</div>

</li>
<li>

Step 2 uses **Previous Step Memory** with append off, so it reads `memory1` and writes into a forked `memory2`.

<div class="docs-screenshot-compact">

![Second AI··Task reading prior memory and writing into a forked thread](./assets/second-ai-task-reading-prior-memory.png)

</div>

</li>
<li>

Step 3 uses **Advanced** with memory ID `memory1` and append on, so it continues `memory1` and does not see
`memory2`.

<div class="docs-screenshot-compact">

![Third AI··Task Advanced mode targeting memory1 with append enabled](./assets/third-ai-task-advanced-mode-targeting.png)

</div>

</li>
</ol>

</details>

## Keep in mind

- Memories are **environment-scoped**. The same memory ID in another environment is a different thread.
- Retention follows the flow’s audit / data retention settings.
- If input memory exceeds the model context window, older messages may be truncated; Logs show what the step actually
  considered.

<div class="docs-screenshot-compact">

![AI··Task Logs memory view showing input messages considered and output messages written](./assets/ai-task-logs-memory-view-showing.png)

</div>

- In a **For each** with concurrency, appending several jobs to one memory can reorder messages by completion time.

## Related

- [Analyze files with AI··Task](../analyze-files-with-ai-task/)
- [AI··Task: Prompt guidelines](../ai-task-prompt-guidelines/)
- [Use AI··Agent](../use-ai-agent/)
- [AI··Swarms: Multi-agent orchestration](../ai-swarms-multi-agent-orchestration/)
