class

PlayerAgentDriver

Inherits InputDriver < Reference < Object

AI player that explores the dungeon autonomously. Used by --autopilot to exercise the full DM + tool-runner pipeline through many turns of natural language actions. Runs on a cheap model (Haiku) to keep long runs affordable.

Constants

FALLBACK_ACTION = "look around"

Fallback action used when the player-agent API call fails, so a transient error (rate limit, 5xx, network blip) doesn't abort the whole stress run.

PLAYER_MODEL = Anthropic::Model::CLAUDE_HAIKU_4_5

Model for the automated player agent. Haiku keeps long autopilot runs cheap.

PLAYER_SYSTEM_PROMPT = "You are an adventurous player in a text-based dungeon-crawl game.\n\nReply with ONE short, concrete action in natural language, for example:\n\"attack the goblin with my sword\", \"pick up the silver key\",\n\"go through the north door\", \"drink a health potion\", \"search the chest\".\n\nRules:\n- Output ONLY the action. No narration, no quotes, no preamble.\n- Be bold and varied: explore, fight, loot, use items, move around.\n- Never output \"quit\", \"exit\", or any meta/system command.\n- Keep it under 20 words."

Constructors

new(model : String = PLAYER_MODEL)
Source

Instance methods

next_action(state : GameState, last_response : String | Nil) : String | Nil

Return the next action string, or nil to end the game (EOF / stop signal).

Source