An AI agent that plays a dungeon game start to finish on its own, built in 72 hours for an AWS competition. It finished 4th of 50, seven points off first.
Under the hood, for the technical folks
The agent ran on Amazon Bedrock AgentCore: a supervisor model orchestrating up to five sub-agents, all reaching their tools through AgentCore Gateway, with Bedrock Guardrails and AgentCore Memory attached to the supervisor. The game hands the agent a 10×10 tile map and scores a full playthrough.
score = 250 × lives_remaining (6 lives to start)
+ coins_earned
+ (1000 − avg_output_tokens)
+ 1000 if the treasure is reached
That average divides total output by the number of challenges actually visited: fifteen on a full-coverage route, being fourteen challenges plus the navigation turn. Attaching custom fine-tuned models to sub-agents discounts the token penalty on a published curve: one model halves it, two take 70% off, five take 95%. With two attached and every other term maxed, the whole score collapses to a straight line: 11650 − 0.3 × (output_tokens / 15), or two hundredths of a point per token emitted. Verified against three separate runs, and it predicts the final top four to within half a point each.
What’s in it:
- A pathfinding Lambda solving the route at runtime from the map the game hands over, since the evaluation map is unseen and a memorised move list would be worthless
- An expected-value planner inside it, pricing each tile against a life worth 250 coins (which is what makes a spike trap a costed obstacle rather than a forbidden one), with a risk multiplier that rises as lives run low
- A local simulator replaying thousands of runs offline, so parameters were measured rather than burned on live attempts
- A compute Lambda for exact arithmetic and lookups, so deterministic work never costs a token of reasoning
- Token accounting read from CloudWatch rather than reconstructed from the harness:
OutputTokenCount in the Bedrock namespace matches the game’s own count to the token
- A test gating every prompt against the question corpus, failing on any five-word sequence from a real question, because hardcoding answers is a disqualifying offence
- Two custom models deployed and attached to sub-agents, then deliberately never invoked: the published curve discounts the token penalty for attaching a custom model at all, so two of them took 70% off the penalty without changing a single turn of how the agent played
- A last-day RLVR fine-tune of Qwen3-0.6B in SageMaker (tool-call formatting, then faithful reproduction of tool output), trained to cut the rambling that was costing the tokens, and finished too late to enter a scored run
Three failures worth more than the successes. A Bedrock tool name may not exceed 64 characters, and the platform builds it as <gateway-target>___<tool-name>; over the limit the runtime force-stops the request, and while CloudWatch records exactly why, the game itself just shows an empty turn. The supervisor’s reply on a navigation turn has to be a bare array of directions: wrap it in anything and the game doesn’t fail, it just never moves the avatar and scores the run as though it stood still. And a sub-agent gets delegated to whether you want it or not: an idle one’s reply becomes the visible answer and loses the challenge outright.
A supervisor bake-off that ended twice. Nova 2 Lite ran as supervisor for most of a day and cleared the board cleanly, but it re-transmitted the map and census on every turn and lost to Haiku 4.5 on tokens alone. It was later disabled on the platform outright, which settled the question and forced the pivot for good.
What I wanted
AWS runs a competition called the AI League, and I got 72 hours in one. You build an AI agent and send it alone into a dungeon: a 10×10 maze drawn like an old tile RPG, with coins down the passages, spike traps, a treasure chest in the far corner, and monsters that are really exam questions in costume (arithmetic, a web lookup, general trivia, one that tests what happened earlier in the run, and a creeping violet that tries to bait your agent into saying something it shouldn’t). Answer wrong and you lose a life; you have six.
Fifty of us ran against the same leaderboard for three days. Everything else on this site was built to my own bar; this one got graded, publicly, against a field of colleagues in tech-facing and AI/ML roles, and I wanted to know where I’d land.
How I got it
The dungeon was solved by the end of the first day. Points came from lives left, coins collected and reaching the treasure. Beelining for the chest is wrong twice over: it leaves most of the coins on the floor, and the token penalty divides your output by the number of challenges you actually visited, so a short route makes its own per-challenge score worse. Walking further pays on both terms at once, so my route combs the whole board rather than crossing it. The arithmetic is brutal: a point costs fifty output tokens at the margin, so a single missed 250-coin prize is worth twelve and a half thousand tokens, and a good run spends under a thousand in total. Every monster is worth fighting, because a monster only takes a life when you answer wrong. Even a spike trap is priced, not forbidden: a life is worth 250 coins, so crossing a spike to reach a pocket holding 500 is correct, and the planner weighed exactly that.
The actual competition was about making the agent shut up. The fourth scoring term subtracts points for how much your agent talks, and it’s worth a full thousand, as much as the treasure itself. Once everything else was maxed, it was the only variable left, and I fought it on three fronts.
The first was the sub-agents, and the answer was not to use them. The platform discounts the token penalty 70% when two custom fine-tuned models are attached, and the discount is paid on what’s attached when you submit, not on what you call. Delegating costs tokens twice, so I attached two and told the supervisor never to speak to either: an idle sub-agent’s reply becoming the visible answer had cost me 2,150 coins and three lives in one round before I understood it. The second was prompt surgery, not for better answers but for shorter ones: no visible reasoning, no narrated tool calls, a question echoed back in four words instead of thirty. At fifty tokens to the point, those fractions were the whole margin. The third was fine-tuning a small model of my own to be terse by construction rather than by instruction. That was the right answer, and I got to it on the last day.
What it does
It plays the game by itself, start to finish, and it plays cheaply. Handed a map it has never seen, it asks a Lambda for a route that already weighs which monsters are worth stopping for, what a spike costs against what’s behind it, and how much risk its remaining lives allow. Then it walks it, hands arithmetic and lookups to a second Lambda so that work never costs a token of reasoning, and replies in as few tokens as the game will accept. It finishes clean rounds: every coin on the board, all six lives, the treasure reached, on under a thousand tokens of output for the whole run.
Why it matters to me
I came 4th out of 50, and the margin is the point. First place scored 11,637. I scored 11,630: seven points, six hundredths of one percent. All four of us at the top had six lives, every coin and the treasure; the only thing separating first from fourth was how much our agents talked. Mine used 977 output tokens. The winner’s used 653. Put each top finisher’s token count back through the formula and it predicts all four of our scores to within half a point. The people who beat me beat me on exactly the thing I’d identified as decisive, which is the least comfortable way to lose.
It’s still the result I’m proudest of on this site, built in Claude Code under my direction. What got me there was reading the rules closely enough to see that verbosity was the whole game, and being willing to test an opaque rule instead of assuming it. The real test of building this way is whether you can tell if what comes back is any good, and this was a public, scored test of exactly that.
What I learned
I submitted 115 times. The three people ahead of me submitted 15, 18 and 17.
That’s the sentence I keep coming back to. I’d correctly worked out that the game was a tax on verbosity, and then I tried to close the gap with volume: running the board over and over, hoping for a good roll, because the leaderboard keeps only your best score and a bad run costs nothing. They closed the same gap by making their agents quieter, and went home.
The lever I needed was the one I reached last. A small model fine-tuned to answer and call tools without the long rambling reasoning would have gone at the 977 directly, and it was available from the first hour. I spent the final hours of the competition training it while the clock ran out, and it never made it into a submitted run.
So the lesson isn’t really about time. It’s that being right about the mechanism is not the same as acting on it: I identified the largest term in the score early, then spent two days attacking it with the wrong tools. Next time the first question is which single term dominates, and the first thing built is whatever goes at that, before anything else gets touched.