All Products
Search
Document Center

Microservices Engine:Prompt management

Last Updated:Sep 01, 2026

Nacos 3.1.1 and later provides prompt management with centralized storage, version control, multi-environment isolation, and dynamic updates for end-to-end prompt lifecycle management. When a Nacos instance is hosted by MSE, you can configure and manage prompts in the MSE console to improve development collaboration and production stability.

Prerequisites

Create a prompt

  1. Log on to the MSE microservices registry console and select a Region in the top menu bar.

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

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

  4. In the navigation pane on the left, choose Prompt Management. In the upper-left corner of the page, select a Namespace, and then click Create Prompt.

  5. On the Create Prompt page, configure the following parameters and click OK.

    • Prompt name: The name cannot be changed after creation.

    • Version: The version number of the prompt. It must follow the semantic versioning specification (major.minor.patch), for example, 1.0.0.

    • Description: A brief description of the prompt's purpose and use cases.

    • Prompt template: The content of the prompt. You can define replaceable parameters in the format {{parameter_name}}.

Delete a prompt

  1. Log on to the MSE microservices registry console. In the top menu bar, select a Region.

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

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

  4. In the navigation pane on the left, choose Prompt Management. In the upper-left corner of the page, select a Namespace. Find the target prompt and click Delete in the Actions column.

View prompt details

  1. Log on to the MSE microservices registry console and select a Region in the top menu bar.

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

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

  4. In the navigation pane on the left, click Prompt Management, and in the upper-left corner of the page, select a Namespace.

    • The prompt list displays all prompts in the selected namespace, including the name, published version, and description.

  5. Click a prompt name to view its details.

    • The prompt details page shows the version number, commit message, prompt template, and parsed parameters for the current version.

    • Use the drop-down list to the right of the prompt name to view the version history. Click a version number to view its details.

Edit a prompt

  1. Log on to the MSE microservices registry console and select a Region in the top menu bar.

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

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

  4. In the navigation pane on the left, choose Prompt Management. In the upper-left corner, select a Namespace. Find the target prompt and click Edit in the Actions column.

  5. In the Edit prompt panel, modify the prompt content.

    1. Basic information: Modify the prompt template. The Parameter preview section shows parameter changes before and after your edits. MSE Nacos provides sample templates as a starting point.

    2. Version information: Enter a new version number (must be greater than the latest version) and a commit message describing the changes.

  6. Go to the prompt list page and click the edit icon in the description column to modify the prompt description.

Important

Published versions cannot be modified. To make changes, publish a new version. By default, version history is retained for 30 days.

Optimize a prompt

MSE Nacos includes a built-in AI optimization engine that analyzes and improves prompt quality by clarifying ambiguous wording, refining logical structure, adjusting writing style, and adding security constraints and boundary conditions.

  1. Log on to the MSE microservices registry console and select a Region in the top menu bar.

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

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

  4. In the navigation pane on the left, click Prompt Management, and in the upper-left corner of the page, select a Namespace.

  5. Click a prompt name to go to the prompt details page.

  6. Click the Optimize Prompt button, enter your optimization requirements, and click Optimize.

  7. After a short wait, the engine returns the optimized content. You can choose whether to replace the original content.

  8. After replacing the content, click Publish New Version in the upper-right corner to publish the optimized prompt.

Debug a prompt

MSE Nacos provides prompt debugging for quick validation and iteration. Enter a question in the console and view the AI response in real time without deploying your application. Adjust template variables and observe how outputs change to find the best parameter combination.

  1. Log on to the MSE microservices registry console and select a Region in the top menu bar.

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

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

  4. In the navigation pane on the left, click Prompt Management, and in the upper-left corner of the page, select a Namespace.

  5. Click a prompt name to go to the prompt details page.

  6. Use the Debug prompt pane on the right to test your prompt:

    1. Enter the user input and the corresponding values for the template parameters.

    2. Select the model for debugging.

    3. Adjust the model parameters as needed.

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

    5. The Model response section displays the model's response.

Search for a prompt

  1. Log on to the MSE microservices registry console and select a Region in the top menu bar.

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

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

  4. In the navigation pane on the left, choose Prompt Management. In the upper-left corner of the page, select a Namespace.

  5. In the search box above the prompt list, enter a prompt name and click the image.png search icon or press Enter. Fuzzy search is supported.

Query and subscribe to prompts with the Nacos client

Python

Install dependency

pip install nacos-sdk-python

Client configuration

from v2.nacos import NacosNamingService, NacosConfigService, NacosAIService, ClientConfigBuilder, GRPCConfig, \
    Instance, SubscribeServiceParam, RegisterInstanceParam, DeregisterInstanceParam, \
    BatchRegisterInstanceParam, GetServiceParam, ListServiceParam, ListInstanceParam, ConfigParam
   
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 a prompt

config_client = await NacosConfigService.create_config_service(client_config)

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

# Subscribe to the prompt
async def config_listener(tenant, data_id, group, prompt):
    print("listen, tenant:{} data_id:{} group:{} prompt:{}".format(tenant, data_id, group, prompt))

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

# Prompt format
# {
#     "promptKey": "assistant",
#     "version": "1.0.1",
#     "template": "You are a professional {{language}} code generation assistant. Generate {{type}} code based on user requirements. Requirements:\n1. Code style: {{style}}\n2. Comment language: {{comment_lang}}\n3. Complexity: {{complexity}}\n",
#     "commitMsg": "This is an initial version"
# }

Java

Add dependency

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

Client configuration

String serverAddr = "localhost:8848";

ConfigService configService = NacosFactory.createConfigService(serverAddr);

Query and subscribe to a prompt

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

// Subscribe to the prompt
configService.addListener("{promptKey}.json", "nacos-ai-prompt", new Listener() {
    
    @Override
    public void receiveConfigInfo(String prompt) {
        System.out.println("receive prompt:" + prompt);
    }
    @Override
    public Executor getExecutor() {
        return null;
    }
    
});