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

# Patterns

> Track user needs, agent behavior, and outcomes in one catalog with conversation evidence

A **pattern** describes something worth tracking in a conversation: a user goal,
repeated frustration, an agent mistake, or an outcome. Agnost AI evaluates the
complete conversation, including both user input and agent output, against the
patterns configured for your workspace.

## Define patterns

Open **Patterns** in the sidebar to create, edit, or remove definitions. Describe
the condition that should count as a match and any important exceptions. For example:

* The user compares pricing plans before upgrading.
* The user repeats a request because the agent lost context.
* The agent claims a task succeeded without evidence that it completed.
* The agent exposes account information before confirming identity.

For agent behavior, describe the failure you want to detect rather than just a
positive instruction. Avoid conditions that depend on evidence Agnost AI never
receives. You can also generate suggestions from your product description and
observed conversations, then approve the relevant patterns.

Keeping a definition's current title is allowed when editing or approving it, even
if historical definitions share that title. A new title must remain unique among
active and suggested patterns. Statistics, timelines, and distribution summaries
aggregate by exact title.

## Choose where a pattern applies

Use **Applies to** when creating or editing a pattern to add conditions for user,
conversation, or event metadata, agent name, success, or raw user ID. With no
conditions, the pattern applies everywhere. Conditions combine with AND; selected
values within a condition combine with OR. Event conditions must match the same
event. Metadata matches exact scalar values or JSON array members. The complete
conversation remains available as classification evidence.

Filters stay editable. Saving filters removes excluded historical matches and,
for an active pattern, queues classification of up to 500 recent conversations.
Filtered candidates come from matching events in the last 30 days. Retained
matches keep their feedback. Retry the same filters if cleanup or queueing fails.

The Patterns API and MCP tools use `metadata_filters`:

```json theme={null}
{
  "metadata_filters": [
    {"source": "event_field", "key": "agent_name", "values": ["slack_assistant"]},
    {"source": "conversation_metadata", "key": "environment", "values": ["production"]}
  ]
}
```

Omitted or `null` means unrestricted on create and preserves saved filters on
update. `[]` clears filters. Supported sources are `user_metadata`,
`conversation_metadata`, `event_metadata`, `event_field` (`agent_name` or `success`),
and `user_id` (use key `""` and the raw conversation user ID). Use up to 20 conditions,
keys up to 200 UTF-8 bytes, and 1–50 unique nonblank values per condition of up to
1000 UTF-8 bytes each. Sources, keys, and values are trimmed, values deduplicated
and sorted, and conditions canonically sorted. Success values normalize to
`failure`, `success`, or `non_critical`; `false` includes both failure states.
The retired `agent_names` field returns an error; put agent names in an
`event_field` condition instead.

## Review the evidence

The catalog shows match volume, activity over time, and the reported cost of
matching conversations. Open a pattern to inspect themes and the matching input
and output together. A match can refer to either participant; the surrounding
conversation determines whether the condition applies.

Use the feedback controls to appreciate or reject a match. Review the supporting
conversation before treating a classified finding as a product issue. A match
count is evidence of the pattern, not proof that the user succeeded.

Use the shared filters to inspect user metadata, conversation metadata, event
metadata, success, and agent name. The Users page also groups matching patterns
alongside the conversations that produced them.

## Act on a pattern

Choose **Alert** on a pattern to monitor a count threshold over a selected window.
Connect [Auto Improve](https://docs.agnost.ai/using-improvements.md) to turn recurring failures into
reviewable changes. The same catalog and evidence are available through the
[Analysis API](https://docs.agnost.ai/high-level-apis.md) and [MCP server](https://docs.agnost.ai/agnost-mcp-server.md).

> [!NOTE]
>
> Patterns replace the separate Intents and Violations catalogs. Existing agent
> behavior definitions are migrated into this catalog. Pattern matching is
> monitoring evidence; critical authorization and safety checks belong in your application.

## Next steps

* [Conversations](https://docs.agnost.ai/using-conversations.md): inspect the full evidence behind a match.
* [Alerts](https://docs.agnost.ai/using-alerts.md): monitor important patterns and thresholds.
* [Improvements](https://docs.agnost.ai/using-improvements.md): turn repeated findings into agent changes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.