Lime Web Components API Documentation - v7.11.0
    Preparing search index...

    Interface AIActionWithApprovalAlpha

    An AIAction that the user approves before it runs.

    The chat shows the ApprovalPreview that prepare returns and calls its run only if the user approves. If the user denies it, nothing runs.

    interface AIActionWithApproval {
        description: string;
        id: string;
        inputSchema: JsonSchema;
        needsApproval: true;
        prepare(input: JsonValue): Promise<PreparedApproval>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    description: string

    Tells the AI what the action does and when to use it.

    id: string

    Identifies the action, e.g. 'limeobject.update' or 'explorer.filter'.

    Use a stable id that is unique on the page. The AI asks for an action by this id.

    inputSchema: JsonSchema

    Describes the input the action takes, as a schema for a JSON object.

    needsApproval: true

    Discriminant. The user approves the action before it runs.

    Methods

    • Alpha

      Describe what running the action with this input would change, and get the function that runs exactly that.

      Called before the user is asked, so it must not change anything. The input comes from the AI and has not been checked against inputSchema. The action checks it, because it knows rules a schema cannot express, such as access rights and which objects exist, and the registry carries no JSON Schema validator.

      Parameters

      Returns Promise<PreparedApproval>

      The preview to show the user and the run to call if they approve. Reject when the input is not valid, with a message the AI can act on: the registry answers 'invalid' and the user is not asked. 'invalid' is for bad input, but the registry also logs every rejection as a warning, so an unexpected error still reaches the console. The AI reads the message, so do not put internal error details in it, such as URLs, status codes or stack text.