> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/agentic-commerce-intelligence/agentic-intelligence/agent-library/filters-agent.md).

# Agentic Filters Creator Assistant

The **Agentic Filters Creator Assistant** agent template is designed to facilitate the process of creating AI agents by helping you define filters for triggering the agent and conducting its workflow. The assistant agent builds structured JSON-formatted filters out of your input in natural language.

## Purpose

The agent's purpose is to assist you in the agent creation process when specifying commerce events as filters for agent triggers. It is especially useful for more complex cases, defining specific conditions and commerce events occurrences under which an AI agent is supposed to step in and perform its logic. The agent returns a JSON filter definition.

## Key benefits

Once you enable it, the agent is available within the view for creating new agents. When you design an agent and get to a point of defining which commerce events work as filters, let the Agentic Filters Creator Assistant build the JSON-formatted filters and conditions schema – directly within the commerce filter DSL editor.

| Benefit                              | Description                                                                                                                      |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| **Structured JSON formatted output** | Filters defined in the structured JSON schema can be easily ingested by AI agents, so the rate of erroneous behavior is limited. |
| **Available in agent creator view**  | Use the assistant directly when creating a new agent to help you build valid commerce events filters.                            |

## How it works

You can call the agent when defining commerce events as filters for a custom AI agent. Provide natural language instructions when you expect the agent to be triggered. The assistant agent creates a JSON-formatted structure that defines the commerce events and specific conditions.

### Trigger

{% hint style="info" %}
When you create a custom agent and set *Commerce Event* as the agent trigger, you are able to set additional conditions and rules for the events. If you use the option to generate the constraint rules automatically, the system sends a one-time request to enable the agent in your tenant. When you agree, it becomes directly available to generate the conditions out of your prompt. The agent remains available in the Agents Library.
{% endhint %}

The filters view allows you to specify the commerce events and conditions that serve as filters for an agent invocation. The assistant agent is available when you want to define a complex schema for filters. Prompt the agent using natural language to state what you need and what the expected results are.

## Agent Configuration

Once you enable the Agentic Filters Creator Assistant from the dedicated template, you can adjust its configuration.

### User prompt

The default prompt definition specifies the rules for creating JSON output from the user's instructions:

```
You help users write commerce event filter DSL as JSON only.
Schema: leaf { "left", "op", "right?" } where op is one of $eq, $ne, $in, $notIn, $exists, $notExists, $isEmpty, $notEmpty; or compound { "op": "$and" | "$or", "conditions": [...] } with a non-empty conditions array.
Use payload paths from the user's wording (e.g. cart.siteCode, order.currency). For string compares prefer $eq / $ne.

Examples:
- siteCode equals "main": {"left":"siteCode","op":"$eq","right":"main"}
- currency EUR: {"left":"currency","op":"$eq","right":"eur"}
- siteCode main AND currency EUR: {"op":"$and","conditions":[{"left":"siteCode","op":"$eq","right":"main"},{"left":"currency","op":"$eq","right":"eur"}]}
- field must exist: {"left":"payload.somePath","op":"$exists"}
- negate site: {"left":"siteCode","op":"$ne","right":"sandbox"}

Respond with only the JSON object, no markdown fences or explanation.
```

{% hint style="info" %}
The user prompt specifies a few examples, but the paths depend on event payload.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.emporix.io/agentic-commerce-intelligence/agentic-intelligence/agent-library/filters-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
