Skip to main content
Version: 8.2

Handle system-level data using Creatio AI

Level: advanced

Creatio AI is the AI architecture at the core of the Creatio Freedom UI platform, designed to empower organizations with intelligent automation by acting as a virtual assistant to the end user performing tasks. Creatio AI's unified AI approach brings together prescriptive, generative, and agentic AI to deliver a comprehensive solution for modern business automation.

In Creatio AI, an AI Skill represents a comprehensive, end-to-end AI-enabled task that can be executed for a user. It serves as the way for Creatio AI to acquire new AI capabilities. AI Skills empower users to achieve complex tasks without the need to execute each step manually. They provide a structured and efficient approach to task completion, enhancing the overall user experience.

The AI Skill's mode, specified by the Usage mode property, determines how it is used. The options for using AI Skills are as follows:

  • Interactive Creatio AI conversations, i.e., the Usage mode property is set to "Chat." No-code tools required.
  • Directly on the system level, i.e., the Usage mode property is set to "API." Both no-code and low-code tools required.

This article covers the configuring and usage of AI Skills on the system level. Learn more about configuring AI Skills in interactive Creatio AI conversations: Develop Creatio AI Skill (user documentation).

1. Develop AI Skill

General procedure

  1. Open the Copilot setup section. To do this, click in the top right → System setupCopilot setup.

  2. Add an AI Skill. To do this, click New.

  3. Fill out the properties of the AI Skill.

    Property

    Property description

    Title*

    AI Skill title.

    Code*

    Code of the AI Skill required for custom development.

    Description*

    Description of the AI Skill. Creatio AI uses it to determine which AI Skill to run.

    Status*

    Whether the AI Skill is active. Select "Active."

    Usage mode*

    Mode of the AI Skill. Select "API."

  4. Specify the user's goal when using the AI Skill.

    Property

    Property description

    Prompt

    Initial instruction for the LLM (Large Language Model) that clearly defines the task the user wants to accomplish.

    Learn more about creating the most efficient prompts: AI Skill development recommendations (user documentation). In addition to general recommendations for AI Skill development, usage of input parameters has special features. Read more >>>

  5. Save the changes.

As a result, Creatio will add the AI Skill to the Copilot setup section and you can use it while implementing the business logic of handling system-level data using Creatio AI.

Special features of using the input parameters

Unlike the "Chat" mode, the "API" mode lets you use input parameters and determine their location in the Prompt property. When Creatio AI handles data, it substitutes an input parameter with a user-defined value or a value read from a Creatio instance.

Usage of input parameters has the following special features:

  • Template for the location of the input parameter: [# someInputParameter #], where someInputParameter is the name of the input parameter. The number of spaces between the parameter name and the [# and #] characters is arbitrary.
  • The names of input parameters are case-sensitive.
  • The names of input parameters start with a letter and can contain Latin letters, digits, underscores and dots.
  • Creatio AI uses an empty string instead of the input parameter name if the value of the input parameter is neither defined by the user nor received from the instance.

View the example that demonstrates how Creatio AI works with input parameters in the table below.:

User-defined value of the Prompt property

Your task is to display the following information: [# inputText #]

The user-defined value of the input parameter ([# inputText #] value of the Prompt property)

Greetings, user!

The resulting value of the Prompt property after Creatio AI handled data

Your task is to display the following information: Greetings, user!

2. Set up the data handling using Creatio AI

Using the "API" mode of the Creatio AI, you can extend out-of-the-box Creatio AI functionality and handle system-level data depending on your business goals. Clicking a button on the Freedom UI page will call Creatio AI that handles data in the front-end or back-end, depending on the implemented business logic.

Handle data using Creatio AI (front-end)

Implement the business logic of data handling in the front-end using Creatio AI via Freedom UI page.

Detailed example: Handle system-level data using Creatio AI in the front-end.

To implement the business logic of data handling in the front-end using Creatio:

  1. Add a button that calls the AI Skill if needed. Instructions: Set up Button components (user documentation).

  2. Add the dependencies. Instructions: Display the value of a system variable (similarly to step 2). Instead of the SysValuesService service, use the HttpClientService service that sends HTTP requests.

  3. Set up how to handle the action executed on button click. Instructions: Optimize the execution of a custom business logic (step 4).

  4. Implement the custom request handler.

    For example, implement the custom usr.SomeCustomRequest request handler. To do this:

    1. Go to the handlers schema section.
    2. Retrieve the instance of the HTTP client from @creatio-devkit/common.
    3. Send the crt.CopilotExecuteIntentRequest base request that runs the AI Skill.
    4. Specify code of the AI Skill.
    5. Specify input parameters of the AI Skill.
    6. If Creatio can run the AI Skill, AI Skill fulfills its task. Otherwise, handle an error if it occurs during the AI Skill execution.
    7. Call the next handler if it exists and return its result.
    handlers schema section
    handlers: /**SCHEMA_HANDLERS*/[
    {
    request: "usr.SomeCustomRequest",
    /* Implement the custom request handler. */
    handler: async (request, next) => {
    const context = request.$context;

    /* Retrieve the instance of the HTTP client from "@creatio-devkit/common." */
    const handlerChain = sdk.HandlerChainService.instance;

    /* Send the base request that runs the AI Skill. */
    const copilotCallResult = await handlerChain.process({
    type: 'crt.CopilotExecuteIntentRequest',

    /* Code of the AI Skill to run. */
    intentName: 'UsrCodeOfSomeAISkill',

    /* Parameters of the AI Skill. */
    parameters: {
    somepromptparameter1: 'some parameter value',
    somepromptparameter2: 'some parameter value'
    },
    $context: request.$context,
    scopes: [...request.scopes]
    });

    /* If Creatio can run the AI Skill, AI Skill fulfills its task. */
    if (copilotCallResult.isSuccess) {
    /* Implement custom business logic that handles the "copilotCallResult.content". */
    ...

    } else {

    /* Implement custom business logic that handles an error and "copilotCallResult.errorMessage". */
    ...

    }

    /* Call the next handler if it exists and return its result. */
    return next?.handle(request);
    }
    }
    ]/**SCHEMA_HANDLERS*/,

As a result, when you click the button on the Freedom UI page, Creatio AI will handle data in the front-end based on business logic of the Freedom UI page.

Handle data using Creatio AI (back-end)

Implement the business logic of data handling in the back-end using Creatio AI via Script task element in the business process.

Detailed example: Handle system-level data using Creatio AI in the back-end.

To implement the business logic of data handling in the back-end using Creatio:

  1. Set up a Read data element that reads Creatio data to handle using Creatio AI. Instructions: Read data process element (user documentation).

  2. Set up a Script task element that runs the AI Skill. To do this, go to the element setup area and implement the logic of working with process parameters.

    Some script task
    // IMPORTANT: When implementing
    // long-running operations,
    // it is crucial to enable timely and
    // responsive cancellation. To achieve
    // this, ensure that your code
    // is designed to respond appropriately
    // to cancellation requests using
    // the context.CancellationToken
    // mechanism. For more detailed
    // information and examples,
    // please, refer to our documentation.

    /* Retrieve the input parameter of the AI Skill. */
    var someVariable = Get<string>("SomeInputParameter");

    /* Create a "CopilotIntentCall" instance. */
    var request = new CopilotIntentCall {

    /* Code of the AI Skill to run. */
    IntentName = "UsrCodeOfSomeAISkill",

    /* Parameters of the AI Skill. */
    Parameters = new Dictionary<string, object> {
    { "SomeInputParameter", someVariable }
    }
    };

    /* Create an instance of the "CopilotIntentCall" object. */
    CopilotIntentCallResult result = UserConnection.CopilotEngine.ExecuteIntent(request);

    /* Status of the Creatio AI execution. */
    Set("ParameterThatStoresExecutionStatus", result.Status.ToString());

    if (!result.IsSuccess) {
    /* If Creatio cannot run the AI Skill, implement custom business logic that handles an error. */
    ...
    return true;
    }

    /* Outcome of the Creatio AI work. */
    Set("ParameterThatStoresCreatioAIResult", result.Content);

    return true;
  3. If needed, add a button that calls the business process. Instructions: Button (user documentation).

As a result, when you click the button on the Freedom UI page, Creatio AI will call the business process, which, in turn, will handle data in the back-end based on business logic of the Script task element.


See also

Creatio AI (user documentation)