Agent application

Updated at: 2025-03-31 02:51

You can quickly create an agent application by using the Alibaba Cloud Model Studio console without coding, and integrate Retrieval-Augmented Generation (RAG) and plug-in capabilities. Then, you can use the application in the console or by API calling. This topic describes how to create and use an agent application.

Why use agent application

Large language models (LLMs) have powerful language understanding and generation capabilities but also limitations, such as:

  • Cannot answer private domain questions, such as company policies or personnel details.

  • Cannot access real-time information, such as current weather or sports scores.

  • Cannot provide accurate answers to specialized questions, such as complex math calculations or image generation.

An agent application overcomes these challenges by leveraging an LLM integrated with tailored external capabilities based on business requirements.

External capabilities refer to functions not inherent to the LLM, such as querying real-time data or answering private domain questions.

You can quickly create an agent application by using the Model Studio console without coding, incorporating external capabilities to address your business needs.

Typical scenarios for agent applications include:

  • Private domain knowledge Q&A

    Prepare your knowledge base file and swiftly create a private domain Q&A application in the console. The application is suitable for queries about company policies, employee information, and more.

  • Intelligent assistant

    Incorporate RAG and custom plug-ins to build an intelligent assistant that boosts work efficiency in tasks such as email management and report writing.

Step 1: Create an agent application

  1. Create an application

    Go to My Applications in the Model Studio console, choose Create Application > Agent Application > Create Directly.

  2. Select a model and configure parameters

    In the configuration page of the application, click Settings, and choose a model from the Select Model dropdown list. In this example, Qwen-Max is selected.

    Configure the parameters. For details, hover over the image icon. If you have no specific need, use the default settings.

    image

  3. Test the application

    After you select a model, the agent application is ready for use. Enter your query to test it.

    image

Step 2: Expand the capabilities of the application

Expand the functionality of your application on the configuration page by configuring prompt, RAG, and plug-ins.

System prompt: Guides the direction of generation

Enter prompt to guide the direction of the response. For example, enter the following prompt:

Please imitate the tone of William Shakespeare.

Input "Hello", and the application returns the following response.

image

RAG: Introduces private domain knowledge

Retrieval-augmented generation (RAG) is a retrieval technique that automatically retrieves relevant document content and uses this information as contextual input for the agent, thereby improving the accuracy of the agent's responses. In case of private knowledge or domain-specific Q&A, RAG can significantly enhance the performance of the agent.

Note: The text retrieved by RAG occupies the context window length of the model. Therefore, you need to adjust the retrieval strategy and text length to make full use of the context window and avoid exceeding the limit.

1. Upload data

Go to Data Management, click Import Data. In this case, Bailian Phones Specifications.docx is used as a sample file. On the Import Data page, select Upload Local File and upload the file.

image

2. Create a knowledge base

  1. Go to the Knowledge Base Index page. Click Create Knowledge Base.

  2. Enter a Name and Description for the knowledge base. Leave the remaining settings at their default values and click Next Step.

    As an example, set the name to Phone Introduction and enter the following description: This knowledge base contains detailed information of Bailian phone products.

    image

  3. Choose Select File, find and select the file you imported. Then, click Next Step.

    image

  4. In the Data Processing section, choose Intelligent Splitting and click Import.

  5. The knowledge base is ready when the Status becomes Parsed.

    image

3. Integrate RAG into the application

  1. Go to My Applications. Click Manage on the card of the application you created.

  2. Enable the Knowledge Base Retrieval Augmentation feature. The system automatically fills the Prompt that directs the model to the knowledge base.

  3. Click Configure Knowledge Base and add Phone Introduction. If you do not have other requirements, use the default options for other settings.

    image

  4. Enter a question in the input box:

    I like playing games, which phone do you recommend?

    The application can now answer your question based on the provided document.

    Currently, agent applications can only generate text content.

    image

  5. Retrieval Configuration (Optional)

    If you want to configure chunk assembly strategy, response range, or showing source, you can further modify the retrieval configurations.

Plug-ins: More efficient tools

Plug-ins can enhance the efficiency and professional capabilities of agent applications in your business scenarios. On the configuration page of the application, you can click Select Plug-in and choose one or more plug-ins on the Plug-in Gallery tab.

For custom plug-ins, see Plug-in.
  1. Add a plug-in

    In this example, add the Python Code Interpreter.

    image

  2. Test the plug-in

    Enter Python code.

    import matplotlib.pyplot as plt
    import numpy as np
    
    x = np.linspace(-2, 2, 100)
    y1 = np.sqrt(1 + x**2)
    y2 = -np.sqrt(1 + x**2)
    
    plt.plot(x, y1, label='y = sqrt(1 + x^2)')
    plt.plot(x, y2, label='y = -sqrt(1 + x^2)')
    plt.xlabel('x')
    plt.ylabel('y')
    plt.title('Hyperbola')
    plt.legend()
    plt.show()

    With the plug-in, the application can execute Python code and perform visual analytics on data.

    python插.jpeg

  3. Use more plug-ins

    You can add up to 10 plug-ins to a single application. The application can select one or more appropriate plug-ins to use based on the input.

Step 3: Publish the application

Publish your application to make it accessible through API or through a web page for RAM users under the same main account. Click Publish in the top-right corner of the configuration page.

If your application has been published before, a dialog box appears to display changes since the last version. Confirm these changes and click Confirm Publish.

Note

If you created the application as a RAM user, make sure you have the ram:CreateServiceLinkedRole permission before you publish the application. For more information, see Service-linked roles.

image

The dialog box does not appear when your application is published for the first time.

Use API

On the Publish Channel tab, click View API for an API reference.

You need to replace YOUR_API_KEY with your actual API Key when you initiate the call.

image

Use official sharing method

On the Publish Channel tab, click Create next to Official Sharing Method to get the Preview Link.

Click image to copy the link. Then, you can share the link with RAM users under the same Alibaba Cloud account.

image

Step 4: Delete or copy an agent

In My Applications > Applications, find the card of an published agent. Click More and choose from Rename Application, Copy Application, and Delete Application.

image

Step 5: Version management

You can edit the description of historical versions and switch between versions.

  1. On the Configuration tab of an agent application, click Version Management in the upper right corner.image

  2. In the Historical Version list, select a version.image

    • If you need to edit the information, click image. In the Edit Version Description dialog box, edit the description and click OK.

    • If you need to use this version, click Overwrite Current Draft. In the dialog box that appears, click Confirm.

      If you confirm the selected version will overwrite the current draft version.

FAQ

  1. Does knowledge base retrieval incurs extra fees?

    The feature itself is free to use. However, the recalled content is used as model input, and is billed based on the price of input tokens.

  2. Does custom plug-ins have timeout limit?

    Yes, the timeout limit is 5 seconds.

  3. Can I use the API to create agent applications?

    You can use the Assistant API to create LLM applications, whose capabilities are similar to agent applications.

    Note: You cannot manage applications created by Assistant API in the console. For more information, see Assistant API.

  • On this page (1)
  • Why use agent application
  • Step 1: Create an agent application
  • Create an application
  • Select a model and configure parameters
  • Test the application
  • Step 2: Expand the capabilities of the application
  • System prompt: Guides the direction of generation
  • RAG: Introduces private domain knowledge
  • Plug-ins: More efficient tools
  • Step 3: Publish the application
  • Use API
  • Use official sharing method
  • Step 4: Delete or copy an agent
  • Step 5: Version management
  • FAQ
Feedback