How to safely trigger in-game actions from LLM dialogue outputs?
Never let an LLM's raw text run as code. Have the model return structured output (a function call or JSON matching a schema), validate it against a whitelist of allowed actions and parameters, then let your game code - not the model - execute the action.