All Products
Search
Document Center

Microservices Engine:Prompt management

Last Updated:Mar 11, 2026

Microservices Engine (MSE) provides centralized prompt management for Nacos instances running version 3.1.1 or later. You can store, version, optimize, debug, and dynamically update prompts through the MSE console or Nacos SDK, without redeploying your application.

A prompt consists of four components:

ComponentDescription
Prompt nameA unique, immutable identifier. Cannot be changed after creation.
Prompt templateThe prompt content. Use {{parameter_name}} to define replaceable parameters.
VersionA semantic version (MAJOR.MINOR.PATCH) that tracks each change. Published versions are immutable.
DescriptionA summary of the prompt's purpose and use case.

Prerequisites

Before you begin, make sure that you have:

Open the prompt management page

Most operations in this topic start from the same page. To navigate there:

  1. Log on to the MSE Service Registry and Configuration Center Management Console. In the top menu bar, select the Region.

  2. In the navigation pane, choose Microservices Registry > Instances.

  3. On the Instances page, click the target instance name.

  4. In the navigation pane, click Prompt management. In the upper-left corner of the page, select a Namespace.

Create a prompt

  1. On the Prompt management page, click Create prompt.

  2. Configure the following parameters, then click OK.

    ParameterDescription
    Prompt nameA unique identifier for the prompt. Cannot be changed after creation.
    Version numberThe initial version. Follow semantic versioning (MAJOR.MINOR.PATCH), for example, 1.0.0.
    DescriptionA brief introduction to the prompt's purpose and use case.
    Prompt templateThe prompt content. Use {{parameter_name}} to define replaceable parameters.

View prompt details

  1. On the Prompt management page, click a prompt name to view its details. The details page shows the current version number, commit message, prompt template, and parsed parameters.

  2. To view historical versions, use the dropdown list next to the prompt name and click any version number to see its details.

Search for prompts

On the Prompt management page, enter the prompt name in the search box, then click the search icon or press Enter. Fuzzy search is supported.

Edit a prompt

Each edit creates a new version. The new version number must be greater than the current latest version.

Important

After a version is published, it cannot be modified. All changes require publishing a new version. Prompt management retains historical versions for the last 30 days by default.

  1. On the Prompt management page, find the target prompt and click Edit in the Actions column.

  2. In the Edit prompt panel, update the prompt content:

    • Basic information: Modify the prompt template. The parameter preview section shows how supported parameters change before and after editing. MSE Nacos provides a sample template as a starting point.

    • Version information: Enter a new version number and a commit message that describes this change.

  3. To update the description, go to the prompt list page and click the edit icon in the Description column.

Optimize a prompt

MSE Nacos includes a built-in AI optimization engine that automatically analyzes and improves prompt quality. It removes ambiguous phrasing, enhances logical structure, adjusts tone based on the use case, and adds security constraints and boundary conditions.

Note

The optimize and debug features use a different navigation path. In the navigation pane, choose Service Registry and Configuration Center > Instances, then click the target instance name and open Prompt management.

  1. Click a prompt name to open its details page.

  2. Click Optimize prompt, enter your optimization requirements, then click Optimize.

  3. After a short wait, the optimized content appears. Review the result and decide whether to replace the original content.

  4. To apply the optimization, click Publish new version in the upper-right corner.

Debug a prompt

The built-in debugging panel lets you test prompts directly in the console. Enter input, adjust template variables, select a model, and see AI responses instantly without deployment.

Note

The debug feature uses the same navigation path as optimize. In the navigation pane, choose Service Registry and Configuration Center > Instances, then click the target instance name and open Prompt management.

  1. Click a prompt name to open its details page.

  2. In the debugging panel on the right side, configure and test the prompt:

    1. Enter user input and fill in the parameters referenced in the prompt template.

    2. Select a model for debugging.

    3. Adjust model parameters as needed.

    4. Click Generate response in the upper-right corner.

    The model's response appears below.

Delete a prompt

On the Prompt management page, find the target prompt and click Delete in the Actions column.

Query and subscribe to prompts with the Nacos client

Beyond the console, you can query and subscribe to prompts programmatically through the Nacos configuration service. Specify {promptKey}.json as the data_id and nacos-ai-prompt as the group.

The returned prompt follows this JSON format:

{
    "promptKey": "assistant",
    "version": "1.0.1",
    "template": "You are a professional {{language}} code generation assistant. Generate {{type}} code based on user requirements.\nRequirements:\n1. Code style: {{style}}\n2. Comment language: {{comment_lang}}\n3. Complexity: {{complexity}}\n",
    "commitMsg": "Initial version"
}

Python

Install dependencies

pip install nacos-sdk-python

Configure the client

import os
from v2.nacos import (
    NacosConfigService, ClientConfigBuilder, GRPCConfig, ConfigParam
)

# Retrieve credentials from environment variables
client_config = (ClientConfigBuilder()
                 .access_key(os.getenv('NACOS_ACCESS_KEY'))
                 .secret_key(os.getenv('NACOS_SECRET_KEY'))
                 .server_address(os.getenv('NACOS_SERVER_ADDR', 'localhost:8848'))
                 .log_level('INFO')
                 .grpc_config(GRPCConfig(grpc_timeout=5000))
                 .build())

Query and subscribe to prompts

config_client = await NacosConfigService.create_config_service(client_config)

# Query a prompt by its key
prompt = await config_client.get_config(ConfigParam(
    data_id=f"{promptKey}.json",
    group="nacos-ai-prompt"
))

# Subscribe to prompt updates
async def config_listener(tenant, data_id, group, prompt):
    print("Prompt updated - tenant:{} data_id:{} group:{} prompt:{}".format(
        tenant, data_id, group, prompt
    ))

await config_client.add_listener(
    f"{promptKey}.json", "nacos-ai-prompt", config_listener
)

Java

Add dependency

<dependency>
    <groupId>com.alibaba.nacos</groupId>
    <artifactId>nacos-client</artifactId>
    <version>${version}</version>
</dependency>

Configure the client

String serverAddr = "localhost:8848";

ConfigService configService = NacosFactory.createConfigService(serverAddr);

Query and subscribe to prompts

// Query a prompt by its key
String prompt = configService.getConfig(
    "{promptKey}.json", "nacos-ai-prompt", 5000
);

// Subscribe to prompt updates
configService.addListener(
    "{promptKey}.json", "nacos-ai-prompt", new Listener() {

    @Override
    public void receiveConfigInfo(String prompt) {
        System.out.println("Received prompt: " + prompt);
    }

    @Override
    public Executor getExecutor() {
        return null;
    }
});