Building a Custom Agent
You can use the built-in AI agents to streamline content management, but you can also create your own for more flexible integration with Liferay DXP. Follow this example to create an agent that translates English blog content into Spanish, then call it from the AI Assistant. For the full reference on managing agents in the Agent Builder, see Agents.
First, log into your AI Hub account and click Agent Builder in the AI Hub left navigation.

If you don’t have an AI Hub account yet, see Integrating AI Hub with Liferay DXP to get set up.
On the Activate subscription tier, agent creation is limited:
- You must duplicate an existing agent, then customize it.
- You can create up to five custom agents.
To create a new Spanish translation agent,
-
You can start from scratch with the New button, but it’s easiest to copy an existing agent. Find the Make Shorter agent and click Actions
→ Duplicate.
-
Now view the copied agent 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 agent logic. Click the View Workflow button.
-
Change the workflow title to Spanish Translator.
-
In the workflow editor canvas, click on the Make Shorter node.
-
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 agent is created, you can try it out.
Using the Custom Agent
To test or use the custom agent, go back to your Liferay DXP 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 agents. See Enhancing Content Management for more information.
-
Click AI Assistant in the top toolbar to open the chat panel. Paste the source HTML of your blog post and ask the assistant to translate it, for example:
Can you please translate this HTML into Spanish?
The AI Assistant is a supervisor agent to all of the individual agents in your system. Ask it questions and it calls the relevant agents 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 agents and call them with the supervisor agent. To let a custom agent answer from a website’s content, attach a data source to it.