Process flag value in guild.yml for pipelines

Say I have a pipeline that takes as input a path as a flag:

preprocess_bag:
  flags:
    bag_path: "path/to/bag.bag"
  steps:
    - decode_bag bag_path=${bag_path}
    - dump_bag bag_bag=${bag_path_but_with_some_processed} # i.e. strip entire path down to only bag.bag

What I am essentially looking for is something like Make File Name Functions that I can use to manipulate the flags.