> ## Documentation Index
> Fetch the complete documentation index at: https://agents.nanonets.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Tag groups

> Group your learnings by the things they apply to, like vendors or document types, so the agent uses the right rule in the right place.

A rule is often only true for one vendor, one customer, or one document type. **Tag groups** let you tell the agent *what* a rule applies to, so it does not apply that rule everywhere.

For example:

* "Northwind Traders prints the invoice date in DD/MM/YYYY" should only apply to **Northwind Traders** invoices.
* "Bank statements have the closing balance on the last page" should only apply to **bank statements**.

A tag group like `Vendor` or `Document Type` is how the agent keeps these straight.

## How it works

<Steps>
  <Step title="You create a tag group">
    Give it a name and a description. For example, name it `Vendor` with the description "the company that issued the invoice".
  </Step>

  <Step title="The agent tags each task">
    On every task, the agent reads the document and tags it with the matching value (for example `Vendor: Northwind Traders`).
  </Step>

  <Step title="Rules are saved under that value">
    When you correct the agent or add a rule during that task, the rule is scoped to that value. It only applies next time the same value shows up.
  </Step>
</Steps>

<Frame caption="Manage Tags: the Vendor group (Auto-tag) holds values the agent adds as it sees them, while Review Status (Manual) is one you curate yourself.">
  <img src="https://mintcdn.com/nanonets-fb7e8f2a/eksLpltcNl29FEi2/images/manage-tags.png?fit=max&auto=format&n=eksLpltcNl29FEi2&q=85&s=d885517e384c35fbbe8278d91c468558" alt="Manage Tags showing a Vendor group with an Auto-tag label and its values, and a Review Status group with a Manual label" width="1440" height="1000" data-path="images/manage-tags.png" />
</Frame>

When a tag group is set to add values automatically, the agent recognises and tags tasks with it on its own.

## Choose how the agent handles values

Each tag group has one switch: **Automatically add new values**.

<CardGroup cols={2}>
  <Card title="On: the agent manages values" icon="wand-magic-sparkles">
    The agent creates matching values and saves related rules under the right value, tagging tasks on its own. Best for open-ended sets like Vendor, Customer, or Currency.
  </Card>

  <Card title="Off: you manage values" icon="hand">
    You create and apply every value yourself, and the agent won't tag tasks with this group. Best for fixed labels like Priority, Status, or Review Type.
  </Card>
</CardGroup>

In the **Manage Tags** list, an **Auto-tag** label marks groups with the switch on, and a **Manual** label marks groups with it off.

<Note>
  Automatically add new values is **on by default** for new groups. Turn it off for groups you'd rather curate by hand.
</Note>

## Write a good description

The description is the most important field. The agent uses it to decide **which value a task belongs to** and **which rules belong to this group**. A vague description leads to wrong tags and mis-scoped rules.

<Frame caption="With Automatically add new values on, the description is required. It tells the agent what the group identifies and which rules belong to it.">
  <img src="https://mintcdn.com/nanonets-fb7e8f2a/eksLpltcNl29FEi2/images/tag-group-editor.png?fit=max&auto=format&n=eksLpltcNl29FEi2&q=85&s=22b1db6628a4c11acad7787b78dfa9a8" alt="Tag group editor with the Automatically add new values toggle on and a filled-in Vendor description" width="1440" height="1000" data-path="images/tag-group-editor.png" />
</Frame>

A good description does two things:

1. Says what the group identifies.
2. Says which kinds of rules should be scoped to it (and which should not).

```text Vendor theme={null}
Vendor identifies the company that issued the invoice. Use this group for
rules tied to one vendor's invoice layout, field labels, or formatting.
Don't use it for rules that should apply across all vendors.
```

<Tip>
  Name a concrete example of a rule that *belongs* in the group and one that *doesn't*. That single sentence is what keeps the agent from over-scoping or under-scoping a learning.
</Tip>

## How values scope a rule

When you save a rule during a task, the agent attaches it to the values that task was tagged with.

* A rule learned on a **Northwind Traders** invoice is saved under `Vendor: Northwind Traders` and only applies to Northwind Traders invoices.
* A rule that should apply to **every** invoice should not be scoped to a vendor. Keep it as a global (unscoped) rule instead.

<Frame caption="Each rule shows its scope. The two Northwind Traders rules apply only to that vendor; the $10,000 approval rule is general, so it has no scope.">
  <img src="https://mintcdn.com/nanonets-fb7e8f2a/eksLpltcNl29FEi2/images/learning-rules.png?fit=max&auto=format&n=eksLpltcNl29FEi2&q=85&s=30d4b365467e806428a88f1fb815ac24" alt="Rules table where two rules show Northwind Traders and Invoice scope labels and one approval rule has no scope" width="1440" height="1000" data-path="images/learning-rules.png" />
</Frame>

## When the agent tags the wrong value

If learnings aren't landing where you expect, the fix is usually the group's description or a rule's scope. Use this as a checklist:

| What you see                    | Likely cause                                                                       | What to tweak                                                                                                                                    |
| ------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| A rule isn't applying           | The task wasn't tagged with that value, or the rule is scoped to a different value | Open the task and check its tags. If the value is missing or wrong, sharpen the group **description** so the agent tags it consistently.         |
| A rule applies everywhere       | The rule is scoped too broadly                                                     | If it should only apply in one context, scope it to the right value. If it really is general, that's fine; leave it as a global (unscoped) rule. |
| The agent never tags this group | **Automatically add new values** is off                                            | Turn it on so the agent tags tasks and adds values.                                                                                              |

<Tip>
  The single highest-leverage fix is the group **description**. The agent uses it both to pick the right value and to decide which rules belong to the group, so a sharper description fixes most tagging and scoping problems at once.
</Tip>

See [Rules](/docs/guide/rules) for how to edit values and rules.

## When you don't need a tag group

You don't need a tag group for everything.

* If a rule applies to **every** task, keep it as a global (unscoped) rule.
* If you only have one vendor or one document type, you don't need to group by it yet.

<Note>
  Start without tag groups. Add one when you notice a rule should only apply in a specific context, like one vendor's layout.
</Note>
