In this comprehensive guide, we will explore how to set up an HTTP request in n8n to trigger an agent in Tess AI. If you're looking to automate interactions with artificial intelligence agents and integrate this into your workflows, this tutorial is for you.
n8n is a powerful visual automation tool, while Tess AI offers a robust platform to create and manage AI agents. By combining the two, you can create intelligent and efficient automations.
Introduction to n8n and Tess AI
n8n is a workflow automation platform that allows you to connect various applications and services without the need to write complex code. With its intuitive interface, you can drag and drop nodes to build custom workflows.
The Tess AI, on the other hand, is a generative artificial intelligence platform that enables the creation of intelligent agents for various purposes, from chatbots to data analysis and more complex tasks. Integrating these two tools opens up a world of possibilities for intelligent automation.
Prerequisites and Getting Started with n8n
Before we begin, make sure you have an account on n8n and an agent created on the Tess AI platform. In n8n, start by creating a new workflow. To begin configuring the HTTP request, use the node search bar and look for "HTTP Request." Drag and drop this node into your workflow; it will be the central point for communicating with Tess AI.
The Importance of Tess AI Documentation
A key resource for correctly setting up the HTTP request is the Tess AI documentation.
Navigate to the agents section and look for the part explaining how to "Run an Agent." There, you will find crucial information about the request structure, required parameters, and examples that can simplify the configuration in n8n.
Tess AI often provides pre-configured examples that can be directly imported into n8n, saving time and minimizing errors.
Importing Tess AI Pre-configuration into n8n
To simplify the initial setup, Tess AI often provides an "import" with a pre-configuration to trigger its agents.
Within the "HTTP Request" node in n8n, you can find an option to import configurations. Delete any existing configuration and paste the pre-configuration copied from the Tess AI documentation. This pre-configuration will already bring the basic structure of the request, speeding up the process.
Understanding the Essential Fields of the HTTP Request
When importing the pre-configuration or manually configuring, you will come across three main fields that require attention:
URL (API Endpoint): This field defines where the request will be sent. Typically, it follows a pattern like https://tess.pareto.io/api/agents/{id}/execute
. The {id}
will be replaced by the specific ID of your agent on Tess AI.
Headers: Headers are metadata that accompany the request. For Tess AI, the most important is the authorization header. It ensures that Tess AI recognizes you have permission to trigger the agent. This header typically includes your API token.
Body: The body carries the data you want to send for the agent to process. Here, you define the user's message, additional parameters, or any information the agent needs to perform its task. The body format is usually JSON.
curl --request POST \
--url 'https://tess.pareto.io/api/agents/{id}/execute' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"temperature": "1",
"model": "tess-ai-light",
"messages": [
{ "role": "user", "content": "hello there!" }
],
"tools": "no-tools",
"waitExecution": false
}'
Obtaining the Agent's ID in Tess AI
Each agent you create in Tess AI has a unique identifier, the ID. To find your agent's ID, go to the Tess AI platform and open the page for the specific agent you want to trigger. The ID usually appears in the page URL. For example, in a URL like https://tess.pareto.io/pt-BR/dashboard/user/content/templates/add-or-update/11333
, the agent ID is 11333
. Copy this ID and replace the placeholder {id}
in the HTTP request URL in n8n.
Generating and Inserting the Tess AI API Token
The API Token is your access credential for Tess AI. To generate it, on the Tess AI platform, look for the "API Tokens" section or similar. Create a new token (remember that tokens are confidential and should be kept secure).
After creation, copy the provided token. In n8n, within the "HTTP Request" node, in the headers section, add a new header with the key Authorization
and the value Bearer {your_token_here}
, replacing {your_token_here}
with the token you copied. "Bearer" indicates the type of token being used.
Customizing the Message Sent to the Agent
Within the request body, you define the message to be processed by the agent. The exact structure of the body will depend on your agent's configuration in Tess AI, but for chat agents, it is common to use a JSON structure with fields like role
and content
.
The content
is where you include the actual message. If you are integrating with other tools in n8n, such as a user chat input, you can use n8n expressions to dynamically insert the user's message into the content
field.
In n8n, use the expression functionality (usually accessed via an icon {}
) to reference the message input and insert it in the correct place within the JSON body.
We hope this detailed article is helpful and meets your expectations!