Sunday - last edited Sunday
I wanted to know if one Databricks function can play Tetris, and what Unity Gateway sees when an AI agent hammers it move after move.
It started with the ai_decide announcement by Jane Zhang, Matthew Ding and Archika Dogra. Their demo is Snake on Databricks Apps: on every tick the board goes to ai_decide, and it picks the next direction. I loved it. Then I thought: Snake has a few directions. Tetris has up to 34 legal drops per piece, holes you can never fix, and a stack that kills you if you get lazy.
The same month, Unity Gateway got a pile of changes (next section). I wanted a real workload to push through it, not a hello world.
So I put the whole game in one Unity Catalog function and let ai_decide, a classic bot and a bunch of LLMs play it in my own Azure workspace. This is purely my experience from my personal sandbox (no client data), so your numbers will differ.
What I wanted to find out:
October was a big month: the docs now call it Unity Gateway (the workspace sidebar still says AI Gateway), and almost every week brought governance features for agents, not just models.
| Date | What changed | Status |
| 28 Oct | ug usage in the Unity Gateway CLI shows your personal and shared spend limits | Not stated |
| 27 Oct | Claude, Claude Code, ChatGPT, Codex and Cursor can connect to Databricks MCP servers without an admin creating an OAuth app | GA |
| 27 Oct | Built-in usage dashboard: spend per model and user, coding agents, MCPs, skills, tag attribution | Not stated |
| 26 Oct | Spend Status API for Unity Gateway budgets | Not stated |
| 21 Oct | The Jailbreak guardrail can screen MCP tool calls and their results | Beta |
| 20 Oct | ai_enrich can use an external MCP search tool registered in Unity Gateway | Beta |
| 15 Oct | Consumer-access users can query Unity Gateway services, with budgets and rate limits | GA |
| 12 Oct | Skills API and developer tools | Beta |
| 9 Oct | Request tags inside service policies, and OpenJev as the LLM-as-a-judge evaluator | Beta |
| 9 Oct | Amazon Bedrock Mantle as a model provider | Not stated |
| 7 Oct | External partner guardrails as service policies | Beta |
| 7 to 27 Oct | New models: Claude Haiku 5.5, Gemini 4 Argon, DeepSeek V4.1 Flash (1017), GPT-6.1 Terra | New |
Source: Databricks release notes, October 2026. ai_decide itself is older: Beta since 30 September.
The entire game is one Unity Catalog Python function, play(state, move): you pass the current state as JSON plus a move, and it returns the next state. No app, no cluster to keep alive.
How the race is wired: three kinds of players, one function
The game loop asks a player for a drop and hands the move to play(); only the LLM calls go through the Unity Gateway unified API with request tags.
What's inside, about 200 lines of plain Python with only the standard library:
Three calls are all you need:
SELECT play(NULL, 'NEW 7'); -- start a game with seed 7 SELECT play(:state, 'AUTO'); -- let the bot place the piece SELECT play(:state, 'r1_c4'); -- play a move
The play function in Catalog Explorer: one Python function, the whole game
Two things I only saw in my workspace. The first call took about 30 seconds in both runs (a cold start). Warm calls still took 3 to 4 seconds each, and with 11 game sessions running at once the median was 5.5 seconds per move. My one-function engine was slower than most of the AI players. And Catalog Explorer showed the function as Deterministic: False, even though it is deterministic, so v2 declares it DETERMINISTIC.
With only the board to look at, ai_decide topped out after 19 pieces with zero lines. With a short description of each drop, it survived all 40 pieces and cleared 6 lines, where the bot cleared 14.
In my first run no LLM could play (next section), so it became ai_decide against the bot, in two rounds:
| Player | Round | Pieces | Lines | Invalid moves | Same pick as the bot | Decision time p50 | p95 |
| Classic bot | raw | 40 | 14 | 0 | 100% | under 1 ms | under 1 ms |
| ai_decide | features | 40 | 6 | 1 | 45% | 624 ms | 1,676 ms |
| ai_decide | raw | 19, topped out | 0 | 1 | 5.3% | 626 ms | 1,688 ms |
What I learned:
The real lesson isn't about Tetris: ai_decide judges options you describe. The quality came from how I described the choices, not from the board.
My workspace runs on a Databricks demo account, and none of the four models announced in October could play there: three aren't there at all, and the fourth is listed but blocked.
The Unity Gateway Models page on my demo account: the sidebar says AI Gateway, the title says Unity Gateway
That's on my side: it's a demo account, and it doesn't have every model switched on. Still a good reminder that "now available on Unity Gateway" in the release notes doesn't mean it's on for your account. Open your own Models page before you plan anything around a new model.
Small things I noticed on the way:
So the LLM race below runs on the models my account actually has.
With move descriptions, GPT OSS 120B cleared 14 lines and Llama 4 Maverick 12, the same level as the classic bot. On the raw board, no AI player cleared more than one line.
Lines cleared in one 40-piece game. Light bar: raw board. Dark bar: board plus move descriptions.
Run 2 played 11 game sessions in 4.8 minutes, all on the same seeded pieces. Claude was blocked on my demo account, so four open models played, plus ai_decide.
| Player | Round | Pieces placed | Invalid moves | Same pick as the bot | Median decision | Output tokens |
| GPT OSS 120B | features | 40 | 0 | 60% | 1.6 s | 18,232 |
| Llama 4 Maverick | features | 40 | 0 | 47.5% | 0.26 s | 200 |
| Gemma 3 12B | features | 35, topped out | 1 | 27.8% | 0.20 s | 216 |
| ai_decide | features | 35, topped out | 9 | 20% | 0.39 s | none reported |
| Qwen3.5 122B | features | 11, topped out | 12 | 0% | 12.2 s | 24,576 |
| GPT OSS 120B | raw | 14, topped out | 12 | 13.3% | 8.0 s | 27,038 |
| Llama 4 Maverick | raw | 24, topped out | 1 | 12% | 0.26 s | 125 |
| Gemma 3 12B | raw | 25, topped out | 0 | 0% | 0.20 s | 150 |
| ai_decide | raw | 20, topped out | 5 | 9.5% | 0.41 s | none reported |
| Qwen3.5 122B | raw | 11, topped out | 12 | 0% | 12.1 s | 24,576 |
What I learned:
A per-user limit of 5 requests per minute stopped my agent loop after exactly 5 calls, but the same burst through ai_query went straight through, and my custom policy never fired.
Same model, same minute: the unified API was throttled, ai_query was not
Rate limits
The rate limit form, with my per-user default of 5 requests per minute and the ai_query note
A policy that blocks untagged requests
I wrote a custom SQL function policy: deny any request without a project request tag.
CREATE OR REPLACE FUNCTION <catalog>.tetris.require_project_tag(event VARIANT)
RETURNS VARIANT
LANGUAGE SQL
RETURN CASE
WHEN event:context.request_tags.project IS NULL
THEN to_variant_object(named_struct('result', 'DENY', 'reason', 'No project tag, no tokens.'))
ELSE to_variant_object(named_struct('result', 'ALLOW', 'reason', ''))
END;Three minutes after I attached it, an untagged request still came back 200 OK, and neither response carried a databricks_service_policy object. The docs say a DENY comes back as HTTP 200 with exactly that object, so I can't confirm either way yet. Maybe it needed more time, maybe I missed a step.
The policy test: both calls came back 200 OK with no policy object
The policy form showed a few things the docs don't:
Unity Gateway logged every LLM call with my request tags and matched my notebook to the token. But ai_decide never showed up anywhere, and the notebook running the game used more DBUs than all the models together.
| Model | Spend on the usage dashboard | Model serving DBUs | Lines cleared, both rounds | Valid moves, both rounds |
| Qwen3.5 122B | $0.14 | 1.62 | 0 | 0 |
| GPT OSS 120B | $0.05 | 0.55 | 15 | 43 |
| Llama 4 Maverick | $0.04 | 0.45 | 12 | 64 |
| Gemma 3 12B | $0.01 | 0.13 | 2 | 60 |
Spend includes the probe calls, and for GPT OSS 120B also the governance tests. All usage from 31 October.
system.ai_gateway.usage grouped by my request tags: round, player, requests and tokens
The new usage dashboard takes one click: Govern > Create Usage Dashboard > Setup & publish. It has tabs for Overview, Spend, Coding Agents, MCPs, Skills, Performance and a README, and it put my model spend for the day at $0.23 for 306K tokens. Read it with care, though:
The Unity Gateway usage dashboard, Overview tab
One open question: the dashboard shows 12 Anthropic calls averaging 178 tokens, and billing has 0.013 DBU on an Anthropic SKU, while every Claude call through the API returned 403. It looks like ai_query reached Claude when the API couldn't. I'm checking that before I believe it.
Govern the path, not just the model: the same model behaved differently through the unified API, through ai_query and next to ai_decide.
The whole experiment is two notebooks on serverless, and the model tokens for the day cost me $0.23.
If you want the notebooks, let me know in the comments and I'll share them. This is purely my experience on a demo account, so if you try it, I'd love to hear your numbers.
Thanks to Jane Zhang, Matthew Ding and Archika Dogra for the ai_decide Snake demo that started all this, and to Pierre Dellacherie's features and the El-Tetris weights behind the classic bot.
Sources