Building a Custom Task
Private Beta Feature
You can use the built-in AI tasks (i.e., agents) to streamline content management, but you can also create your own for more flexible integration with Liferay DXP. Follow this example to create a task that translates English blog content into Spanish.
First, log into your AI Hub account and click Agent Builder in the left menu.

If you don’t have an account, you can request to be part of the private beta testing program for AI Hub here.
To create a new Spanish translation task,
-
You can start from scratch with the New button, but it’s easiest to copy an existing task. Find the Make Shorter task and click Actions
→ Duplicate.
-
Now view the copied task by clicking Actions
→ View. -
Edit these fields:
Title: Spanish Translator
Description: This writing agent takes your text and translates it to Spanish.
-
Click Save.
-
Now update the task logic. Click the View Workflow button.
-
Change the title to Spanish Translator.
-
In the task editor canvas, click on the Make Shorter node (if you duplicated the Make Shorter task).
-
In the right node editor menu, change the label to Spanish Translator.
-
Change the Node Name to translateToSpanish.
-
Replace the Description with
Translate text to Spanish using LLM models. -
Replace the Prompt with
You are an expert translator. Your sole task is to translate the provided text to Spanish, preserving the exact semantic meaning of the input. If the text is already in Spanish, return it unchanged. Output only the translated text, with no explanations or commentary. -
Replace the User Message with
This is the text to be translated: {{text}}

- Click Update.
Now that the translation task is created, you can try it out.
Using the Custom Task
To test or use the custom task, go back to your running local instance that’s connected to AI Hub.
-
Access a space in the Liferay CMS and edit a blog post.
TipYou can generate a blog post with the built-in writing tasks. See Enhancing Content Management for more information.
-
Open the AI Assistant chat box and enter this text:
Can you please translate this HTML into Spanish? [Copy the Source HTML of some content]
The AI Assistant is a supervisor agent to all of the individual tasks in your system. Ask it questions and it calls the relevant tasks to fulfill the request.
If you ask the supervisor chat agent to translate your blog post to French, it cannot.

Now you can build custom tasks and call them with the supervisor agent.