Built-in Actions

Using Built-in Actions

Moveworks provides a wide range of built-in actions to help you built AI agents quickly.

When you want to use a built-in action in your Compound Action, you can use mw.{{action_name}} as your action.action_name. For example, if you want to use the create_generic_approval_request native action, you would use mw.create_generic_approval_request.

Action Reference

create_generic_approval_request

Create a Moveworks in-bot approval request. Plugin will continue if the approval is answered within 30 days before the approval is dropped from the database.

Action Name: mw.create_generic_approval_request

Input Parameters:

  • approval_key (string): The approval key which describes the approval workflow. If omitted, MUST provide the approvers argument. Currently Supported Keys (Optional)
  • ticket (Ticket): The ticket associated with this request for tracking. (Optional)
  • approvers (List[User]): List of user objects from whom to get approval. Will reach out to all users, but only one approval will be needed. If provided, this will override the approval key. (Optional)
  • approval_details (string): The details that need approval. (Required)
  • users_requested_for (List[User]): Users who we are requesting approval for. (Required)

🚧

Make sure you pass User objects, not emails.

You can retrieve user objects via an email address using our user built-in actions

Request Schema:

- action:
    output_key: create_generic_approval_request_result
    action_name: mw.create_generic_approval_request
    progress_updates:
      on_complete: ON_COMPLETE_MESSAGE
      on_pending: ON_PENDING_MESSAGE
    input_args:
      approval_key: '"MANAGER"'
      approval_details: '"Need access to coupa"'
      users_requested_for: data.users
{
  "approval_key": "string",
  "ticket": "Ticket",
  "approvers": "List[User]",
  "approval_details": "string",
  "users_requested_for": "List[User]"
}

Action Response Schema:

{
    "state": {
      "initial_status": "PROCESSING",
      "status": {
        "[email protected]": "APPROVED"
      },
      "notifiers": {
        "action_callback": {
          "action_id": "ZagCDJRsdeD"
        }
      }
    },
    "status": "APPROVED",
    "approved_by": [
      {
        "full_name": "John",
        "record_id": "10769610738892443",
        "email_addr": "[email protected]"
      }
    ]
}
{
    "state": {
      "initial_status": "PROCESSING",
      "status": {
        "[email protected]": "APPROVED"
      },
      "notifiers": {
        "action_callback": {
          "action_id": "ZagCDJRsdeD"
        }
      }
    },
    "status": "DENIED",
    "denied_by": [
      {
        "full_name": "John",
        "record_id": "10769610738892443",
        "email_addr": "[email protected]"
      }
    ]
}
data.create_generic_approval_request_response.status == "approved"

generate_structured_value_action

Call an LLM and have it produce a structured output.

Action Name: mw.generate_structured_value_action

Input Parameters:

  • payload (object): Payload to analyze when producing outputs. (Required)
  • output_schema (object): Output schema in JSON Schema format with type object, e.g. {"type": "object", "properties": {"name": {"type": "string"}}}}). For more information please check the OpenAI API docs (Required)
  • system_prompt (string): Instructions for the model on how to extract the value. If omitted, will use the default prompt (should be sufficient for most cases). (Optional)
  • strict (boolean): Whether to turn on Structured Outputs to have the model enforce strict adherence to the schema. Default false. If set to true, you will receive an error unless you also set "additional_properties" to false in output_schema and make all fields required (Optional)
  • output_schema_name (string): LLM-facing name for the schema. Defaults to "extracted_value". (Optional)
  • output_schema_description (string): LLM-facing description for the schema. (Optional)

Request Schema:

  - action:
      action_name: mw.generate_structured_value_action
      input_args:
        output_schema: |-
          {
              "type": "object",
              "properties": {
                  "id": {"type": "string"},
                  "department": {"type": "string"}
              },
              "required": ["id", "department"],
              "additionalProperties": False
          }
        system_prompt: >
          "prompt goes here"
        payload:
          user_object: data.user_list
      output_key: mw.generate_structured_value_action_result
{
  "payload": "object",
  "output_schema": "object",
  "system_prompt": "string",
  "strict": "boolean",
  "output_schema_name": "string",
  "output_schema_description": "string"
}

Result Schema:

{
  "openai_chat_completions_response": {
    "choices": [
      {
        "message": {
          "content": "This is an example of structured content produced by the LLM."
        }
      }
    ]
  }
}

generate_text_action

Call an LLM and have it produce some standard text.

Action Name: mw.generate_text_action

Input Parameters:

  • system_prompt (string): Optional message to set the model behavior. (Optional)
  • user_input (string): Context from the user which should be used in this specific generation. (Required)
  • model (string): Selects the model that will be used to generate text. (Optional)

Request Schema:

  - action:
      output_key: generate_text_action_result
      action_name: mw.generate_text_action
      progress_updates:
        on_complete: ON_COMPLETE_MESSAGE
        on_pending: ON_PENDING_MESSAGE
      input_args:
        system_prompt: >
          "prompt goes here"
        user_input: data.user_query
{
  "system_prompt": "string",
  "user_input": "string",
}

Result Schema:

{
  "openai_chat_completions_response": {
    "choices": [
      {
        "message": {
          "content": "This is an example of structured content produced by the LLM."
        }
      }
    ]
  }
}

send_plaintext_chat_notification

Sends a chat notification to a user.

Action Name: mw.send_plaintext_chat_notification

Input Parameters:

  • user_record_id (string): The record ID of the user to notify. To retrieve user record IDs you need to use the Get User by Email or Look up multiple users by email native actions (Required)
  • message (string): The message to send. (Required)

Request Schema:

  - action:
      output_key: send_plaintext_chat_notification_result
      action_name: mw.send_plaintext_chat_notification
      progress_updates:
        on_complete: ON_COMPLETE_MESSAGE
        on_pending: ON_PENDING_MESSAGE
      input_args:
        message:
          RENDER():
            template: "{{name}} from {{department}} has reset your MFA"
            args:
              department: meta_info.user.department
              name: meta_info.user.full_name
        user_record_id: data.get_user_by_email_result.user.id
{
  "user_record_id": "string",
  "message": "string"
}

summarize_text_action

Summarize a given text.

Action Name: mw.summarize_text_action

Input Parameters:

  • text_to_summarize (string): The text to summarize. (Required)

Request Schema:

- action:
    output_key: summarize_text_action_result
    action_name: mw.summarize_text_action
    progress_updates:
      on_complete: ON_COMPLETE_MESSAGE
      on_pending: ON_PENDING_MESSAGE
    input_args:
      text_to_summarize: '"Text to summarize here or pass a variable"'
{
  "text_to_summarize": "string"
}

Result Schema:

{
  "openai_chat_completions_response": {
    "choices": [
      {
        "message": {
          "content": "This is a summarized version of the text provided for summarization."
        }
      }
    ]
  }
}

batch_get_users_by_email

Retrieves multiple users by email against Moveworks' Internal Identity store.

Action Name: mw.batch_get_users_by_email

Input Parameters:

  • user_emails (List[string]): The email addresses of the users to retrieve.

Request Schema:

- action:
      output_key: get_user_by_email_result
      action_name: mw.get_user_by_email
      progress_updates:
        on_complete: ON_COMPLETE_MESSAGE
        on_pending: ON_PENDING_MESSAGE
      input_args:
        user_emails: data.users_to_message_list (easiest what to get this would be a python script)
{
  "user_emails": "List[string]",
}

Result Schema:

{
  "user_records": [
    {
      "lookup_id": "12345",
      "user": {
        "full_name": "John Doe",
        "email_addr": "[email protected]",
        ...
      }
    },
    {
      "lookup_id": "67890",
      "user": {
        "full_name": "Jane Smith",
        "email_addr": "[email protected]",
        ...
      }
    }
  ]
}

You can find the full list of user fields in our Moveworks Data Object page.

get_user_by_email

Retrieve a user record according to their email address. This action will return all user attributes, along with custom attributes.

Action Name: mw.get_user_by_email

Input Parameters:

  • user_email (string): The email address of the user to retrieve.

Request Schema

- action:
      output_key: get_user_by_email_result
      action_name: mw.get_user_by_email
      progress_updates:
        on_complete: ON_COMPLETE_MESSAGE
        on_pending: ON_PENDING_MESSAGE
      input_args:
        user_email: "[email protected]"
{
  "user_email": "string"
}

Result Schema

{
  "user": {
    "full_name": "John Doe",
    "email_addr": "[email protected]",
    ...
  }
}

You can find the full list of user fields in our Moveworks Data Object page.