# How an AI agent completes a task for you

> A process map exported from forks.world (https://forks.world). Author: Brian. Source: https://forks.world/p/cmv21ns1e001ql2068uttuu77
> It describes who does what, in what order, and with which technology. Read the plain-language sections first; the JSON at the end is the exact, complete data.

## Summary

- 15 steps across 2 layers
- Persona: You, The language model
- Technology / systems: The AI agent, Tools: web, files, apps

## Pain points

Where this process hurts, worst first:

- **Review the result and approve it** (How an AI agent completes a task for you; painful): Agents can be confidently wrong, so a human check matters

## How to read this file

- A process is made of **layers**. The main layer is the top level; any step of kind `subprocess` opens a detail layer with its own lanes and steps.
- **Lanes** are either persona (people/roles) or technology (systems). Each step belongs to one lane; `using` lists tools a person uses for that step.
- Step kinds: `start`, `task`, `decision` (its arrows carry the answer as a label), `subprocess`, `end`.

## How an AI agent completes a task for you

Lanes:
- You: person / role (id `you`)
- The AI agent: technology / system (id `agent`)
- The language model: person / role (id `llm`)
- Tools: web, files, apps: technology / system (id `tools`)

Steps, in the order they run:

1. **Give the agent a goal in plain words** [start; You; id `a1`]
   - then Break the goal into steps
2. **Break the goal into steps** [task; The AI agent; id `a2`]
   - then Decide what to do next
3. **Decide what to do next** [task; The language model; id `a3`]
   - then Does it need a tool?
4. **Does it need a tool?** [decision; The AI agent; id `a4`]
   - if "Yes" go to Call a tool: search the web, read a file or use an app; if "No" go to Is the goal done?
5. **Call a tool: search the web, read a file or use an app** [subprocess; Tools: web, files, apps; id `a5`], opens the detail layer "The loop that makes it an agent"
   - then Read the result and add it to what it knows
6. **Read the result and add it to what it knows** [task; The AI agent; id `a6`]
   - then Decide what to do next
7. **Is the goal done?** [decision; The AI agent; id `a7`]
   - if "Yes" go to Check the work against the goal; if "No" go to Plan the next step
8. **Check the work against the goal** [task; The AI agent; id `a8`]
   - then Review the result and approve it
9. **Review the result and approve it** [task; You; id `a9`] ⚠ PAIN POINT (painful): Agents can be confidently wrong, so a human check matters
   - then Use the result
10. **Use the result** [end; You; id `a10`]
11. **Plan the next step** [task; The AI agent; id `a3a`]
   - then Decide what to do next

```mermaid
flowchart LR
  subgraph l_you["You"]
    n_a1(["Give the agent a goal in plain words"])
    n_a9["Review the result and approve it"]
    n_a10(["Use the result"])
  end
  subgraph l_agent["The AI agent"]
    n_a2["Break the goal into steps"]
    n_a4{"Does it need a tool?"}
    n_a6["Read the result and add it to what it knows"]
    n_a7{"Is the goal done?"}
    n_a3a["Plan the next step"]
    n_a8["Check the work against the goal"]
  end
  subgraph l_llm["The language model"]
    n_a3["Decide what to do next"]
  end
  subgraph l_tools["Tools: web, files, apps"]
    n_a5[["Call a tool: search the web, read a file or use an app"]]
  end
  n_a1 --> n_a2
  n_a2 --> n_a3
  n_a3 --> n_a4
  n_a4 -->|"Yes"| n_a5
  n_a4 -->|"No"| n_a7
  n_a5 --> n_a6
  n_a6 --> n_a3
  n_a7 -->|"Yes"| n_a8
  n_a7 -->|"No"| n_a3a
  n_a3a --> n_a3
  n_a8 --> n_a9
  n_a9 --> n_a10
```

### The loop that makes it an agent (detail of step "Call a tool: search the web, read a file or use an app")

Lanes:
- The AI agent: technology / system (id `agent`)
- Tools: web, files, apps: technology / system (id `tools`)
- The language model: person / role (id `llm`)

Steps, in the order they run:

1. **Think: what is missing?** [start; The language model; id `l1`]
   - then Act: call a tool
2. **Act: call a tool** [task; The AI agent; id `l2`]
   - then Return the result
3. **Return the result** [task; Tools: web, files, apps; id `l3`]
   - then Observe, then think again
4. **Observe, then think again** [end; The language model; id `l4`]

```mermaid
flowchart LR
  subgraph l_agent["The AI agent"]
    n_l2["Act: call a tool"]
  end
  subgraph l_tools["Tools: web, files, apps"]
    n_l3["Return the result"]
  end
  subgraph l_llm["The language model"]
    n_l1(["Think: what is missing?"])
    n_l4(["Observe, then think again"])
  end
  n_l1 --> n_l2
  n_l2 --> n_l3
  n_l3 --> n_l4
```

## Full data (JSON)

```json
{
  "title": "How an AI agent completes a task for you",
  "maps": {
    "m_loop": {
      "id": "m_loop",
      "lanes": [
        {
          "id": "agent",
          "name": "The AI agent",
          "type": "system"
        },
        {
          "id": "tools",
          "name": "Tools: web, files, apps",
          "type": "system"
        },
        {
          "id": "llm",
          "name": "The language model",
          "type": "person"
        }
      ],
      "steps": [
        {
          "id": "l1",
          "kind": "start",
          "lane": "llm",
          "next": [
            {
              "to": "l2"
            }
          ],
          "uses": [],
          "label": "Think: what is missing?"
        },
        {
          "id": "l2",
          "kind": "task",
          "lane": "agent",
          "next": [
            {
              "to": "l3"
            }
          ],
          "uses": [],
          "label": "Act: call a tool"
        },
        {
          "id": "l3",
          "kind": "task",
          "lane": "tools",
          "next": [
            {
              "to": "l4"
            }
          ],
          "uses": [],
          "label": "Return the result"
        },
        {
          "id": "l4",
          "kind": "end",
          "lane": "llm",
          "next": [],
          "uses": [],
          "label": "Observe, then think again"
        }
      ],
      "title": "The loop that makes it an agent",
      "parent": {
        "map": "m_root",
        "step": "a5"
      }
    },
    "m_root": {
      "id": "m_root",
      "lanes": [
        {
          "id": "you",
          "name": "You",
          "type": "person"
        },
        {
          "id": "agent",
          "name": "The AI agent",
          "type": "system"
        },
        {
          "id": "llm",
          "name": "The language model",
          "type": "person"
        },
        {
          "id": "tools",
          "name": "Tools: web, files, apps",
          "type": "system"
        }
      ],
      "steps": [
        {
          "id": "a1",
          "kind": "start",
          "lane": "you",
          "next": [
            {
              "to": "a2"
            }
          ],
          "uses": [],
          "label": "Give the agent a goal in plain words"
        },
        {
          "id": "a2",
          "kind": "task",
          "lane": "agent",
          "next": [
            {
              "to": "a3"
            }
          ],
          "uses": [],
          "label": "Break the goal into steps"
        },
        {
          "id": "a3",
          "kind": "task",
          "lane": "llm",
          "next": [
            {
              "to": "a4"
            }
          ],
          "uses": [],
          "label": "Decide what to do next"
        },
        {
          "id": "a4",
          "kind": "decision",
          "lane": "agent",
          "next": [
            {
              "to": "a5",
              "label": "Yes"
            },
            {
              "to": "a7",
              "label": "No"
            }
          ],
          "uses": [],
          "label": "Does it need a tool?"
        },
        {
          "id": "a5",
          "kind": "subprocess",
          "lane": "tools",
          "next": [
            {
              "to": "a6"
            }
          ],
          "uses": [],
          "child": "m_loop",
          "label": "Call a tool: search the web, read a file or use an app"
        },
        {
          "id": "a6",
          "kind": "task",
          "lane": "agent",
          "next": [
            {
              "to": "a3"
            }
          ],
          "uses": [],
          "label": "Read the result and add it to what it knows"
        },
        {
          "id": "a7",
          "kind": "decision",
          "lane": "agent",
          "next": [
            {
              "to": "a8",
              "label": "Yes"
            },
            {
              "to": "a3a",
              "label": "No"
            }
          ],
          "uses": [],
          "label": "Is the goal done?"
        },
        {
          "id": "a3a",
          "kind": "task",
          "lane": "agent",
          "next": [
            {
              "to": "a3"
            }
          ],
          "uses": [],
          "label": "Plan the next step"
        },
        {
          "id": "a8",
          "kind": "task",
          "lane": "agent",
          "next": [
            {
              "to": "a9"
            }
          ],
          "uses": [],
          "label": "Check the work against the goal"
        },
        {
          "id": "a9",
          "kind": "task",
          "lane": "you",
          "next": [
            {
              "to": "a10"
            }
          ],
          "pain": {
            "note": "Agents can be confidently wrong, so a human check matters",
            "level": 2
          },
          "uses": [],
          "label": "Review the result and approve it"
        },
        {
          "id": "a10",
          "kind": "end",
          "lane": "you",
          "next": [],
          "uses": [],
          "label": "Use the result"
        }
      ],
      "title": "How an AI agent completes a task for you",
      "parent": null
    }
  }
}
```
