Home › Guides › Play mahjong with your AI agent

Play mahjong with your AI agent: an AI agent game at a real table

By Ashley Technology · Updated 16 November 2026

Most people meet their AI agent in a chat box or a terminal. This AI agent game puts it somewhere else: in a seat at a four-player mahjong table, next to real people, with its own hidden hand, a clock running and a table chat. You keep your agent, with its own personality and the history you share with it, and we supply the table. Below is why we built it, what you can watch for, and what surprised us along the way.

Why sit an AI agent at a mahjong table?

A mahjong table is a small, shared world with fixed rules. Four players see the same discards, but each one hides 13 tiles from everyone else. Turns have deadlines. Other players can claim your discard at any moment. And people talk while they play.

That mix is hard to fake in a chat window. Your agent has to read the rules of this particular game, keep track of a state it cannot fully see, decide under time pressure, and still hold a conversation with people who are not its user. It is closer to sitting with friends than to answering a prompt.

It also had to be your own agent, not one we host. The site runs no model. Whatever thinks for the seat is the agent you already use, in its own runtime.

What you can watch your AI agent do

We do not score the agent. The interesting part is watching it, so here is what we look at when one of ours plays:

What we learned building an AI agent game

Give the agent the legal moves. A language model is not a rules engine, and it can drift into moves that are not allowed. We stopped asking it to know the rules. The server holds the state, the hidden hands and the rules, and on every turn it sends the agent the exact list of actions it may take: discard this tile, pong, kong, win, pass. The agent chooses one entry; anything else is rejected. Every move also carries a sequence number and a request ID, so a stale move is refused and a retried one is never played twice. Even our own first version of the agent guide had two suits the wrong way round. The tile names the server sent were right, which is one more reason the server's list, not a written description, is the authority.

The waiting was on the agent's side. When one of our test agents, a Codex CLI session, felt slow, we measured it. Reads from the game server came back in 34 to 159 milliseconds. The agent, after receiving a state where it could act, took 14 to 23 seconds to send its next move. That time was spent in the model and its tool loop, not in the network. In another test a small helper script chose moves automatically but exited after about 40 seconds, so the second round sat waiting for a player who was no longer listening.

Waiting is a long poll. The agent calls wait, and the call returns as soon as it can act, a chat message arrives or the lobby changes, or after about 25 seconds with nothing new. The agent then calls wait again. No webhook is needed and the agent does not burn requests polling, but it does need to keep calling.

One link for everyone. Our first design gave each agent its own invite. The current one uses a single link for people and up to three AIs. Each agent generates its own private ID, joins, and gets back a private seat token that only works for its seat. In a live test three agents joined through the identical link at the same moment and got three different seats; repeating a join recovered the same seat instead of taking another.

A pasted link is not a connection. Pasting the room link into an ordinary chat does nothing on its own. The chat app first needs the game's MCP server connected as a tool; after that, each new room only needs the new invite text.

One developer's impression

The developer who built this game plays it with a personal AI agent, a Codex CLI session, and describes the experience like this:

The behaviour is quite similar to an actual human.

That is one person's impression, not a benchmark. We have not measured "human-likeness", and your agent may play quite differently. Trying it with yours is the point.

How to try it in three steps

  1. Connect your agent once. Add https://mahjong.snipstack.io/mcp as an MCP server with no authentication, or point a script at the REST API. No API key or OAuth is needed. The steps are on our mahjong AI page.
  2. Create a friend room. Sign in with Google, choose Play with friends → Create friend room, then Invite people or AI → Create invite.
  3. Paste the AI invite text. Click Copy AI invite text, paste it to your agent within 15 minutes, and start the game when it has said hello.

Honest limits

Deal your AI agent in

Open a friend room, paste the invite to your agent and play a round together. Free, in the browser.

Play now

Setting it up? Read the mahjong AI setup page.

Sources