# How to use the Agent Component in real scenarios

The **Agent Component** lets you integrate AI models into your pipelines to perform tasks such as classification, moderation, content generation, and data structuring.

In this article, you’ll find a collection of **practical use cases** that illustrate different ways to configure the component, from simple prompts to combinations with JSON Schema, dynamic data, and MCP Server. Each example demonstrates when to use each approach and what kind of results you can expect.

If you want to explore every configuration option in detail, see the [**Agent Component**](https://app.gitbook.com/s/EKM2LD3uNAckQgy1OUyZ/connectors/ai-tools/llm) documentation.

## **Configuration with User Prompt only**

This configuration uses only the **User Prompt** parameter to send a request to the AI model.

{% hint style="success" %}

#### **Advantages:**

* Easy to set up with just one input.
* Good for testing different prompts quickly.
* Works well for simple requests.
  {% endhint %}

#### **Practical example**

* **Use case:** A pipeline integrated with Zendesk receives a new customer ticket. The Agent Component is used to analyze the request and classify its topic.
* **Goal:** Classify the topic of a support ticket.

**User Prompt:**

{% code overflow="wrap" %}

```
Classify the topic of the following customer request:  
"My payment was declined, but the amount was debited from my account. I need help fixing this."
```

{% endcode %}

**Example output:**

{% code overflow="wrap" %}

```json
{
  "body": {
    "text": "**Topic:** Payment Issue / Failed Transaction\n\n**Explanation:**  \nThe customer is reporting a problem where their payment was declined, but the money was still debited from their account. This falls under payment issues, specifically failed or unsuccessful transactions with debited funds."
  },
  "tokenUsage": {
    "inputTokenCount": 39,
    "outputTokenCount": 52,
    "totalTokenCount": 91
  }
}
```

{% endcode %}

## **Configuration with User + System Prompts**

This configuration uses both the **User Prompt** and **System Prompt** parameters to guide the AI response.

{% hint style="success" %}

#### **Advantages:**

* Helps guide the AI’s tone and behavior.
* Makes responses more consistent.
* Adds context that helps the AI understand the prompt better.
  {% endhint %}

#### **Practical example**

* **Use case:** After classifying the support ticket, the pipeline queries a knowledge database. The Agent Component is then used again to generate a personalized response for the customer.
* **Goal:** Generate a custom response using predefined tone and style.

**System Prompt:**

{% code overflow="wrap" %}

```
You are a friendly and helpful support agent. Always use an empathetic tone and provide clear instructions. Return the message as plain text with no line breaks.
```

{% endcode %}

**User Prompt:**

{% code overflow="wrap" %}

```
Write a response to the customer below, explaining that we will investigate the payment and get back to them within 24 hours:  
"My payment was declined, but the amount was debited from my account. I need help fixing this."
```

{% endcode %}

**Output:**

{% code overflow="wrap" %}

```json
{
  "body": {
    "text": "Thank you for reaching out and letting us know about the issue with your payment. I understand how concerning it is to see a charge when your payment was declined. We will investigate this matter right away and get back to you with an update within 24 hours. Thank you for your patience while we look into this for you."
  },
  "tokenUsage": {
    "inputTokenCount": 89,
    "outputTokenCount": 65,
    "totalTokenCount": 154
  }
}
```

{% endcode %}

## **Configuration with Prompts + JSON Schema**

{% hint style="info" %}
Support for **JSON Schema** may vary across LLM providers and models. We recommend reviewing the official documentation of the provider and model before configuring to confirm compatibility.
{% endhint %}

This configuration uses **User Prompt**, **System Prompt**, and **JSON Schema** to generate a structured response.

{% hint style="success" %}

#### **Advantages:**

* Keeps the output consistent with a defined format.
* Validates field types, required fields, and allowed values automatically.
* Works as a contract between systems, making integration more reliable.
* Prevents invalid data from being processed.
  {% endhint %}

#### **Practical example**

* **Use case:** A pipeline receives a user-generated comment from an ISV (independent software vendor) platform. The Agent Component sends the comment to the AI to evaluate whether it’s harmful or offensive. The returned score is then used to decide whether the comment should be published or if the user should be flagged.
* **Goal:** Evaluate and score a comment’s harmfulness and determine whether it should be approved.

**System Prompt:**

{% code overflow="wrap" %}

```
You are a content moderator. Evaluate whether the comment is harmful, assign a score from 0 to 1 for severity, and indicate whether it should be approved.
```

{% endcode %}

**User Prompt:**

{% code overflow="wrap" %}

```
Evaluate the following comment:  
"I had a great experience with this company. The team is professional and very helpful."
```

{% endcode %}

**JSON Schema:**

{% code overflow="wrap" expandable="true" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ModerationResult",
  "type": "object",
  "properties": {
    "status": {
      "type": "integer",
      "enum": [200],
      "description": "HTTP status code"
    },
    "body": {
      "type": "object",
      "properties": {
        "score": {
          "type": "string",
          "pattern": "^(0(\\.\\d+)?|1(\\.0+)?)$",
          "description": "Severity score from 0 to 1"
        },
        "label": {
          "type": "string",
          "description": "Label describing the content, e.g., harmless, potentially harmful"
        },
        "should_approve": {
          "type": "boolean",
          "description": "Indicates whether the comment should be approved"
        }
      },
      "required": ["score", "label", "should_approve"],
      "additionalProperties": false
    }
  },
  "required": ["status", "body"],
  "additionalProperties": false
}
```

{% endcode %}

**Output:**

{% code expandable="true" %}

```json
{
  "body": {
    "status": "200",
    "body": {
      "score": "0",
      "label": "harmless",
      "should_approve": true
    }
  },
  "tokenUsage": {
    "inputTokenCount": 168,
    "outputTokenCount": 22,
    "totalTokenCount": 190
  }
}
```

{% endcode %}

## **Configuration with Prompts + plain JSON**

This configuration uses **User Prompt**, **System Prompt**, and plain **JSON** (no schema) to return a structured response.

{% hint style="success" %}

#### **Advantages:**

* Produces output in a simple, readable format.
* Flexible and easy to work with.
* Good when strict validation isn’t necessary.
  {% endhint %}

#### **Practical example**

* Using the same use case as above, the prompts guide the AI to return a JSON object directly, without schema validation.

**System Prompt:**

{% code overflow="wrap" %}

```
You are a content moderator. Evaluate whether the comment is harmful, assign a score from 0 to 1 for severity, and indicate whether it should be approved.
```

{% endcode %}

**User Prompt:**

{% code overflow="wrap" %}

```
Evaluate the following comment:  
"I had a great experience with this company. The team is professional and very helpful."
```

{% endcode %}

**Plain JSON:**

```json
{
  "score": "",
  "label": "",
  "should_approve": ""
}
```

**Output:**

```json
{
  "body": {
    "score": "0",
    "label": "Not harmful",
    "should_approve": "yes"
  },
  "tokenUsage": {
    "inputTokenCount": 91,
    "outputTokenCount": 26,
    "totalTokenCount": 117
  }
}
```

## **Configuration with Prompts + Double Braces**

This configuration uses the **User Prompt** field to dynamically inject data from a previous connector using Double Braces expressions. In addition, the **System Prompt** and **Output Format** fields are used to guide the AI and generate a structured response.

{% hint style="success" %}

#### **Advantages:**

* Enables contextual prompts based on pipeline data.
* Connects the AI response to runtime information.
  {% endhint %}

#### **Practical example**

* **Use case:** A pipeline receives address data from a [REST connector](https://app.gitbook.com/s/EKM2LD3uNAckQgy1OUyZ/connectors/web-protocols/rest-v2) that queries a Brazilian public ZIP code API (OpenCEP). The Agent Component is then used to classify the type of address as residential, commercial or rural, based on the street name and neighborhood returned by the API.
* **Goal:** Categorize the address type using dynamic data from the previous connector.

**System Prompt:**

{% code overflow="wrap" %}

```
You are an address classification assistant. Based on the street name and neighborhood, classify the address as residential, commercial, or rural. Explain your reasoning.
```

{% endcode %}

**User Prompt with Double Braces:**

```
Use the following address to make your evaluation: {{message.body}}
```

**JSON Schema:**

{% code expandable="true" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "name": "address_classification_response",
  "type": "object",
  "properties": {
    "status": {
      "type": "integer"
    },
    "body": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["residential", "commercial", "rural"]
        },
        "reason": {
          "type": "string"
        }
      },
      "required": ["type", "reason"]
    }
  },
  "required": ["status", "body"],
  "additionalProperties": false
}
```

{% endcode %}

**Output:**

{% code overflow="wrap" expandable="true" %}

```json
{
  "body": {
    "status": 200,
    "body": {
      "type": "residential",
      "reason": "The street name 'Rua Josina Teixeira de Carvalho' and the neighborhood 'Vila Anchieta' in São José do Rio Preto indicate a typical urban residential area. There is no indication of commercial or rural characteristics in the address."
    }
  },
  "tokenUsage": {
    "inputTokenCount": 170,
    "outputTokenCount": 62,
    "totalTokenCount": 232
  }
}
```

{% endcode %}

###

## **MCP Server configuration**

This configuration uses an **MCP Server**, combined with **User Prompt**, **System Prompt**, and **JSON Schema**, to request and structure documentation generated from external data sources.

{% hint style="success" %}

#### **Advantages:**

* Enables secure communication between AI models and source systems.
* Keeps the generated output consistent with a predefined format.
* Validates required fields and data types automatically.
* Ensures reliable and accurate documentation generation.
  {% endhint %}

#### **Practical example**

* **Use case:** A pipeline connects to the Deepwiki MCP server to retrieve technical knowledge about a topic. The AI transforms this raw information into structured documentation.
* **Goal:** Generate a documentation section about *Event-Driven Architecture* with a clear title, short description, practical use cases, and best practices.

**MCP Server:**

* **Name:** DeepWiki
* **URL:** [`https://mcp.deepwiki.com/mcp`](https://mcp.deepwiki.com/mcp)

**System Prompt:**

{% code overflow="wrap" %}

```
You are a technical documentation generator. Always write in clear and concise English, using a professional but simple tone.
Your task is to transform raw information retrieved from external tools (such as Deepwiki) into well-structured documentation.
Ensure your output is consistent, accurate, and aligned with the requested format.
```

{% endcode %}

**User Prompt:**

{% code overflow="wrap" expandable="true" %}

```
Use the information retrieved from the Deepwiki MCP server about the topic "Event-Driven Architecture" to create a documentation section.
The documentation must include:
- A clear title.
- A concise description (2–3 sentences).
- At least three practical use cases.
- At least three best practices.
Format the response strictly following the provided JSON schema.
```

{% endcode %}

**JSON Schema:**

{% code overflow="wrap" expandable="true" %}

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "DocumentationSection",
  "type": "object",
  "required": ["title", "description", "use_cases", "best_practices"],
  "properties": {
    "title": {
      "type": "string",
      "description": "The title of the documentation section"
    },
    "description": {
      "type": "string",
      "description": "A concise description of the topic (2-3 sentences)"
    },
    "use_cases": {
      "type": "array",
      "description": "Practical use cases for the topic",
      "items": {
        "type": "string"
      },
      "minItems": 3
    },
    "best_practices": {
      "type": "array",
      "description": "Recommended best practices for the topic",
      "items": {
        "type": "string"
      },
      "minItems": 3
    }
  },
  "additionalProperties": false
}
```

{% endcode %}

**Output:**

{% code overflow="wrap" expandable="true" %}

```json
{
  "body": {
    "title": "Event-Driven Architecture",
    "description": "Event-Driven Architecture (EDA) is a software design pattern where system components communicate by producing and consuming events. This approach enables loosely coupled systems that can react to changes in real time, improving scalability and flexibility. EDA is commonly used in distributed systems and applications requiring asynchronous processing.",
    "use_cases": [
      "Building microservices that need to communicate asynchronously.",
      "Implementing real-time analytics platforms that process streaming data.",
      "Automating workflows in response to business events, such as order processing or user actions."
    ],
    "best_practices": [
      "Design events to be self-contained and descriptive to ensure clear communication between components.",
      "Use reliable messaging systems to guarantee event delivery and avoid data loss.",
      "Monitor and log event flows to quickly detect and resolve issues in the system."
    ]
  },
  "tokenUsage": {
    "inputTokenCount": 396,
    "outputTokenCount": 162,
    "totalTokenCount": 558
  }
}
```

{% endcode %}
