How to load a template-part based on a url wildcard?

I ended up with this solution in functions.php, thanks to the offical WordPress documentation at: https://codex.wordpress.org/Rewrite_API/add_rewrite_rule

First added a custom rewrite rule like so:

function custom_rewrite_rule() {
    add_rewrite_rule( 
        '^agenda/([^/]*)/([^/]*)/?',
        'index.php?page_id=10&agenda_id=$matches[1]&agenda_name=$matches[2]',
        'top' );
}

add_action( 'init', 'custom_rewrite_rule', 10, 0 );

Then this needed to be added:

function prefix_register_query_var( $vars ) {
    $vars[] = 'agenda_id';
    $vars[] = 'agenda_name';

    return $vars;
}

add_filter( 'query_vars', 'prefix_register_query_var' );

Now URL’s such as /agenda/1/event-title work like a charm! And passes the variables needed.

PS: Remember to save the permalinks settings in the backend once again, or this code won’t work!