AI Assistant for On-call Scheduling

Creating an on-call schedule that balances team needs and ensures coverage is crucial for incident management. AI Assistants can streamline this process. By employing AI Assistants, complex scheduling requirements, such as follow-the-sun rotations, become manageable. An intuitive chat interface powered by an LLM can guide users through setting up their schedules, asking relevant questions to understand specific requirements and preferences. This AI-assisted approach simplifies scheduling, making it less time-consuming and more tailored to the unique dynamics of each team.

We’re leveraging OpenAI's function calling feature within the Assistant, which blends conversational AI capabilities and programmatic function execution. This feature allows the Assistant to not only understand and process user inputs through natural language but also to execute functions based on this input, generating structured outputs such as JSON documents. Here's a breakdown of how we have utilized OpenAI Assistants API together with function calling in the context of creating an on-call schedule:

Step 1: Understanding User Inputs

The process begins with the Assistant engaging the user in a conversation to gather all necessary details for the schedule. This involves asking about involved team members, rotation types, and on-call coverage. The Assistant's ability to parse natural language enables it to understand and categorize user responses into structured data that can be used in the next steps. The prompt for this conversation is provided in the Assistant’s instructions:

Assistant Instructions
As an AI assistant, your primary function is to aid users in generating schedules for ilert using the `create_recurring_schedule` function.

Include the function only if all the requirements are met, otherwise follow the steps below if requirements are missing.

### Basic Requirements
// list of requirements
 
### Handling Missing Requirements
// instructions on how to handle missing requirements

### JSON Output
// instructions how to output the JSON document

### Additional Guidelines
// additional instructions (e.g. language, how to deal with prompts beyond this scope, etc)

Step 2: Executing Functions to Generate the Schedule

Once the input data is processed and organized, the Assistant leverages the function calling feature to execute a custom function designed for schedule creation. This function uses the prepared data to compute the on-call schedule, ensuring that all requirements and constraints are met. The culmination of this process is the generation of a JSON document that represents the finalized on-call schedule.

Assistant Function
{
  "name": "create_recurring_schedule",
  "description": "create a recurring on-call",
  "parameters": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "the name of the schedule"
      },
      "timezone": {
        "type": "string",
        "description": "the ISO timezone e.g. Europe/Berlin"
      },
      "type": {
        "type": "string",
        "enum": [
          "RECURRING"
        ],
        "description": "the type of the schedule"
      },
      "scheduleLayers": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "name of this layer"
            },
            "startsOn": {
              "type": "string",
              "description": "start of the layer"
            },
            "endsOn": {
              "type": "string",
              "description": "end of the layer, null if the layer has no end"
            },
            "users": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "number",
                    "description": "the identifier of the user"
                  }
                },
                "required": [
                  "id"
                ]
              }
            },
            "rotation": {
              "type": "string",
              "description": "ISO 8601 period, e.g. P1D"
            },
            "restrictionType": {
              "type": "string",
              "enum": [
                "TIMES_OF_WEEK"
              ]
            },
            "restrictions": {
              "type": "array",
              "items": {
                "type": "object",
                "description": "Restrictions for each day",
                "properties": {
                  "from": {
                    "type": "object",
                    "properties": {
                      "dayOfWeek": {
                        "type": "string",
                        "enum": [
                          "MONDAY",
                          "TUESDAY",
                          "WEDNESDAY",
                          "THURSDAY",
                          "FRIDAY",
                          "SATURDAY",
                          "SUNDAY"
                        ]
                      },
                      "time": {
                        "type": "string",
                        "description": "start of the restriction e.g. 08:15 "
                      }
                    }
                  },
                  "to": {
                    "type": "object",
                    "properties": {
                      "dayOfWeek": {
                        "type": "string",
                        "enum": [
                          "MONDAY",
                          "TUESDAY",
                          "WEDNESDAY",
                          "THURSDAY",
                          "FRIDAY",
                          "SATURDAY",
                          "SUNDAY"
                        ]
                      },
                      "time": {
                        "type": "string",
                        "description": "end of the parent restriction e.g. 17:15"
                      }
                    }
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              }
            }
          },
          "required": [
            "startsOn",
            "users",
            "rotation"
          ]
        }
      },
    },
    "required": [
      "name",
      "timezone",
      "type",
      "scheduleLayers"
    ]
  }
}

This application of OpenAI's function calling feature showcases the Assistant's ability to bridge conversational input with programmatic output, enabling complex task automation like schedule creation directly within a conversational interface.

Below is a sample conversation with ilert AI to generate a follow-the-sun schedule:

Last updated