---
title: AI Copilot
description: Speed up integration building with Sensedia AI Copilot
documentId: ipaas-ai
locale: en-US
---

**Sensedia AI Copilot** is an AI assistant specialized in Camel integrations in YAML DSL format.
With this tool, you can create or edit Camel integration scripts quickly, reducing development time and increasing efficiency.

<Callout type="important" title="IMPORTANT">

* Sensedia AI Copilot is currently in **beta** version. This means the functionality is still evolving and may undergo adjustments.

* Enable the **Use AI Chat for Source Code Generation** permission in Access Control to use this functionality.

</Callout>

To use Sensedia AI Copilot:

<Steps>
<Step>
Click the AI Copilot icon in the lower right corner of the **Source** screen, in the **Source Code** tab.
</Step>
<Step>
Enter the _prompt_ with instructions to create or edit an integration and click the arrow on the right to send it.
</Step>
<Step>
Copy the generated code by clicking the copy icon in the right corner of the conversation box.
</Step>
<Step>
Insert the script into the `main.yaml` code editor.
</Step>
</Steps>

<Callout type="important" title="IMPORTANT">
The conversation history will be automatically deleted when you leave the **Source** screen.
</Callout>

## Creating prompts

It is very important that the _prompt_ is clear and specific to get the best results.
Here are some tips for creating effective _prompts_:

- **Camel Components:** explicitly mention the Camel components you want to use and the purpose of each one in the integration route.

   **Examples**

   * Create a route that starts with a `timer` component to execute every 10 seconds. 
   * Use the `http` component to make a GET call to an external API. 
   * Send the result to a queue using the `kafka` component.

- **Enterprise Integration Patterns (EIPs):** specify the EIPs that the route should implement and what should be done at each step.

   **Examples** 

   * Use the `setProperty` EIP to extract the `clientId` field from the JSON body and store it as an exchange property called `idClienteProp`.
   * Use the `setHeader` EIP to define a header called `StatusProcessamento` with the initial value `RECEBIDO`.
   * Use the `setBody` EIP to transform the message body, selecting only the `item` and `quantidade` fields from the original JSON using a `simple` expression.

- **Systems and endpoints involved:** describe the source and destination systems, including their respective _endpoints_ (URIs), when possible.

   **Examples**

   * Read from a Kafka queue called `pedidos_novos`.
   * Send to a `POST` request to the _endpoint_ `http://api.parceiro.com/webhook`.
   * Write to a file in the `/opt/arquivos/processados` directory.

<Callout type="tip" title="TIP">
The more details you provide, the more accurate the generated script will be.
</Callout>

<Callout type="important" title="IMPORTANT">
_Resources_ files and _flow variables_ must be created manually, but Sensedia AI Copilot can suggest their content.
</Callout>

## Examples

Check out _prompt_ examples you can use as reference:

<Callout type="important" title="IMPORTANT">
The examples below are organized into topics for faster and more fluid reading, but you should type your _prompt_ in continuous text, without line breaks.
</Callout>

### SQS to HTTP with JSLT transformation and DLQ

* I want to create an integration that consumes messages from an AWS SQS queue.
* For each message, which is in JSON format, transform it using a JSLT template.
* Then, send the transformed JSON in an HTTP POST request.
* If the HTTP call results in an error, log the error message and the original message body.
* Then, send the original SQS message to an SQS _dead-letter_ queue.
* Use _placeholders_ for AWS _accessKey_ and _secretKey_.

### REST API with JSON validation and HTTP enrichment

* Build an integration with REST API _endpoint_ `POST /orders` that accepts a JSON _payload_.
* First, validate the _payload_ against a JSON _schema_.
* If validation fails, respond with HTTP 400 and a JSON error body.
* If valid, extract the `customerId` and `orderId` from the _payload_. Log these IDs.
* Then, enrich the original message by calling an external HTTP GET service. 
* Store the response from this service (JSON) in a property.
* Finally, build a new JSON response body combining the original order and the `customerDetails`. 
* Log the modified _body_ and return HTTP 200.

### Conditional order processing via REST with Camel and Slack

* Create an integration that exposes a REST POST _endpoint_ at `/api/pedidos`.
* Upon receiving a request, first log the received message.
* Then, evaluate whether the `statusPedido` property in the request body (JSON) equals `CONCLUÍDO`.
* If this condition is true, send the original request _payload_ to another HTTP POST _endpoint_.
* Otherwise, if the condition is false, send a message on Slack with the text `Order with ID is not CONCLUÍDO`.

## Additional tips

* **Specify flow structure**: detail as much as possible the components of the desired flow.
* **Use clear and direct instructions**: provide objective commands about the specific section or complete route to be generated by AI.
* **Mention specific connectors**: indicate the names of connectors that should be used, if you already know them.
* **Break down complex prompts**: for elaborate requests, divide the request into smaller steps and request adjustments from AI as needed.
