Are animation markers part of the timeline or part of an action? I'm trying to use animation markers for events in a game engine. I added several actions to a test file and a few markers.

The markers seem to be the same in all actions, and editing a marker with one action active changes the marker in the other actions.

So the question is, are animation markers stored similar to keyframes inside an action, or are they stored outside the animation? Are they purely meant as an editing tool? Is there a separate mechanism to mark animation events or do I need to script something myself?
It depends, there are Timeline Markers and Pose Markers.

Timeline markers are stored at scene level, whereas Pose markers are stored in an action:

# Timeline markers of current scene
bpy.context.scene.timeline_markers

# Pose markers for 'CubeAction'
bpy.data.actions['CubeAction'].pose_markers


In the Dope Sheet editor, switch to Action Editor.

Click the menu Marker > Show Pose Markers to see pose markers.

With this enabled, creating markers will add pose markers!
(Pose markers show a diamond-shaped icon)

With Show Pose Markers disabled, you may select Timeline markers (they show a triangular icon) and click Marker > Make Markers Local to convert them to Pose markers. Note that the original Timeline marker will be gone. If you want to keep it, make a duplicate before you convert (ShiftD, Esc).