Agents opening apps

Agents can open applications that are included in the launchpad. There are the following main ways to do this:

  • Open an app.

  • Open an app with start parameters, which allows passing data to the app for the developer to perform actions.

Opening an app

To simply open an app, the agent selects and launches it without additional data. This is straightforward and requires no further configuration in the app itself.

Opening an app with start parameters

You must provide a meaningful description of your application in the app settings. This description should explain how the start parameters should look, including required fields and an example.

For example, here is the description for a sick leave registration app that populates a form when opened with start parameters:

*Sick Leave Registration App*
Purpose: Allows employees to submit sick leave requests.
Tasks: Register Sick Leave (Use startParams), Open App (Omit startParams).
Required Fields for Submission: employeeName (Full name), startDate (First day, yyyy-MM-dd), endDate (Last day, yyyy-MM-dd), reason (Explanation for absence).
Example startParams: {"employeeName": "Terry", "startDate": "2025-10-08", "endDate": "2025-10-10", "reason": "Flu symptoms"}

Handling start parameters in the app

In the app code, use the following to handle start parameters:

sap.n.Shell.attachBeforeDisplay(async function (startParams) {
    if (startParams) {
        if (startParams.employeeName) employeeNameInput.setValue(startParams.employeeName);
        if (startParams.startDate) startDatePicker.setValue(startParams.startDate);
        if (startParams.endDate) endDatePicker.setValue(startParams.endDate);
        if (startParams.reason) reasonTextArea.setValue(startParams.reason);
    }
});

With attachBeforeDisplay, each time the agent opens the app, the function runs. If startParams are provided, they are passed into the function.

Perform actions within open apps

If the developer wants the agent to perform actions within other open apps (not just when opening them), define a callback function in the app:

neptune.Ai.onToolFinish(function (opts) {
    console.log("Tool finished!", opts);
});

This callback triggers when an agent executes a tool. The developer can create tools that correspond to specific actions in the app (for example, fill in a form, navigate, or start a process).

The opts object looks like this:

{
  "type": "tool-output-available",
  "toolCallId": "0VQHt7kxu2UohiTB",
  "output": {
    "result": {
      "message": "Email sent successfully to terry@neptune-software.com"
    },
    "toolName": "sendEmail"
  }
}

Here, toolName is the name of the tool, and result contains the final output.

For example, use a switch statement on the toolName to perform specific actions in each case.