Docs/Using Plugins/AI Function Tool

AI Function Tool

The Reminder plugin can be exposed to your agent's AI as a callable function. When enabled, the AI can schedule reminders autonomously during a conversation — for example, when a user asks to be reminded about an appointment or a follow-up.


How It Works

  1. The AI receives the function definition describing how to create a reminder.
  2. When the user's intent requires a reminder, the AI calls the function with the recipient's details and the desired send time.
  3. The plugin validates the call against the configuration's secret and creates the reminder item automatically.
  4. The AI receives a confirmation response and continues the conversation.

Getting the Function Definition

Retrieve the AI-readable function schema for a specific configuration:

GET /api/reminder/ai/function-definition?agentId={agentId}&configurationId={configurationId}&secret={secret}

The response contains the JSON schema the AI uses to understand the function's parameters, including field names, types, and descriptions. Register this definition with your agent's function tool settings in the CMS.


AI Create Reminder Endpoint

When the AI decides to create a reminder, it calls:

POST /api/reminder/ai/create-reminder?secret={secret}&configurationId={configurationId}

Request body:

FieldTypeDescription
userIdstringThe recipient's phone number (without country code). The plugin maps this to the reminder's phoneNumber field.
messagestringThe reminder message content. Stored as the first template parameter.
sendTimedatetimeThe exact date and time to deliver the reminder. Must be in the future.
contextstringOptional. Additional context from the conversation for logging.

Example request:

{
  "userId": "81234567890",
  "message": "Don't forget your appointment with Dr. Sari tomorrow at 09:00.",
  "sendTime": "2025-06-01T08:00:00",
  "context": "User asked for a reminder during appointment booking flow"
}

Authentication

The AI must pass the configuration's Secret in the secret query parameter. This is the same secret generated when the configuration was created. The Dialog service holds this secret and passes it automatically when invoking the function on behalf of an agent.

Never expose the secret in client-facing code or logs.


Validation Rules

The plugin enforces the following on AI-created reminders:

  • sendTime must be in the future. Reminders scheduled in the past are rejected.
  • userId must be a non-empty string.
  • message must be a non-empty string.
  • The configuration's serverState must be running. If paused, the call is rejected.

Function Name Generation

You can use the AI to generate a descriptive function name based on your plugin's purpose. This makes the function identifiable to the agent's AI model.

POST /api/reminder/configuration/generate-function-name

Request body:

{
  "description": "Schedule follow-up reminders for insurance renewal conversations"
}

Response:

{
  "functionName": "schedule_insurance_renewal_reminder"
}

Use this name when registering the function in your agent's tool settings.