On-call schedule optimization that sends to PagerDuty API

Hey all, I built a custom decision model for optimizing on-call schedules that send to the PagerDuty API. It took about one working day and a little help from a few folks, but I’m generally happy with the result and process.

I wanted to optimize for balancing assigned days across users to make more fair schedules while maximizing user happiness by fulfilling preferences as much as possible.

Once I got my local environment set up, I initialized the new app template to start working with the basics I needed to create my new decision model. (I originally explored the shift-scheduling template, which was helpful for some early learning, but realized it’s a bit more sophisticated than what I needed for this model.)

From there, I worked through my schema, sorting out how to represent my input and output data — the modeling equivalent of “visualize yourself hitting the ball” to then dive into the solver magic.

The solver definition piece of this process feels heavy (because it is, but in a good way) and effectively boils down to the following:

  • Start from the current state of the world — the root state
  • Generate possible plans for the operation
  • Tell the solver what is operationally valid
  • Tell the solver how to compare plans, generate new plans, and express plans in the output

One little unassuming function, a whole lot of approachable magic.

From there, I was able to run my model to make on-call schedule decisions and send the plan to the PagerDuty API. In the end, I got the usual rainbow schedules, but knew that they adhered to user preferences and optimized for balance and happiness.

You can read the detailed walkthrough on the Nextmv blog.

We’ve made the PagerDuty schedule template available for you to play with via the Nextmv CLI. Check out how to get started in our documentation.

If you have questions or feedback, let me know!

3 Likes