DEV Community

Cover image for Hono Means Fire in Japanese. I Put One Inside an AI Robot's Hotel Room.
Yuuki Yamashita
Yuuki Yamashita

Posted on

Hono Means Fire in Japanese. I Put One Inside an AI Robot's Hotel Room.

Quick fact before anything else: Hono, the web framework, is named after the Japanese word for flame, 炎, pronounced "honō." The people who made it picked the name because it's small and fast, like a flame. I didn't know that when I started this project. I only found out while writing this post, and once I did, the campfire photo above stopped being a random stock image and started being the whole point.

Here's what I actually did: I took that little flame and put it inside a hotel room built for AI robots, run by Amazon. Then I put two other guests, Express and FastAPI, in identical rooms next door. Same rulebook for all three. I watched who followed it with the least fuss.

The hotel only has two rules

The AI robot hotel is a real AWS product called Amazon Bedrock AgentCore Runtime. You give it a container. Think of a container as a sealed lunchbox that has your program and everything it needs to run, so it works the same no matter whose kitchen it's reheated in. In exchange, the hotel takes care of the boring stuff: giving each guest their own private room, checking IDs, and cleaning up after they leave.

What I didn't expect was how short the actual rulebook is. I went looking for it, expecting pages of setup, and instead found four rules and one optional extra.

Answer on port 8080. A port is just a numbered door, and 8080 is the specific one the hotel's mail carrier will knock on. Reply to GET /ping with your health status, which is the hotel nurse checking your pulse: still alive? You just say Healthy or HealthyBusy. Reply to POST /invocations with an answer, which is the actual doorbell guests press when they have a question for your AI. And be built for ARM64, because every CPU speaks a slightly different language, and this hotel only understands the ARM64 dialect, not the more common one your laptop probably runs.

The optional extra is GET /ws, for a WebSocket. Think of the ping-and-invocations pair as leaving notes under the door, one at a time. A WebSocket is a phone call that stays connected instead.

That's the whole rulebook. No specific framework, no specific language, just "answer these doors correctly." Which means, in theory, you could write this room in absolutely anything.

In practice, every example I found online was written in Python's FastAPI, or in Node's Express. Nobody had tried Hono. So I did.

Building the room

The whole room, all three doors, /invocations, /ping, and /ws, came out to 98 lines. Here's the shape of it, trimmed down:

app.get("/ping", (c) => c.json(ping.body()));

app.post("/invocations", async (c) => {
  const { prompt, stream } = await c.req.json();
  if (!stream) return c.json({ response: await invoke(prompt) });

  return streamSSE(c, async (s) => {
    for await (const chunk of invokeStream(prompt)) {
      await s.writeSSE({ data: JSON.stringify({ event: chunk }) });
    }
  });
});

app.get("/ws", upgradeWebSocket(() => ({
  onMessage(evt, ws) { /* same idea, over a phone call instead */ },
})));
Enter fullscreen mode Exit fullscreen mode

A single-message answer, a drip-fed streaming answer, and a phone-call answer, all three living in the same small file. Nothing about Hono is special-cased for AgentCore — it's just a normal web framework answering normal HTTP requests. The hotel doesn't know or care what's inside the lunchbox.

Three guests, same rulebook

I built the identical room twice more: once in Express, once in FastAPI. Same three doors, same behavior, checked against a 13-point test I wrote that knocks on every door and confirms the room answered correctly — health check, JSON reply, streaming reply, WebSocket reply, and a few edge cases. All three rooms passed all 13 points.

Then I compared them.

Size and speed barely moved. The finished lunchbox was 237MB for Hono, 237MB for Express, and 256MB for FastAPI, and almost all of that weight is the base operating system each one sits on, not the framework itself. Startup time told the same story: Hono and Express were close enough to call a tie, and FastAPI trailed by a few hundred milliseconds. If you were picking a framework based on these two numbers alone, you wouldn't have much of a reason to pick any of them.

The real difference showed up in how much extra plumbing I had to install myself. Express can't handle a WebSocket on its own, so I had to reach into the raw network connection underneath it and manually catch the moment a browser asks to "upgrade" from a normal request into a phone call, then hand that off to a separate WebSocket library. FastAPI's front desk, meanwhile, refused to even open. I'd told it that this door could answer with either a single letter or a streaming phone call, and it tried to build a strict form for that answer and choked on its own rules until I told it to relax.

Hono needed neither fix. The framework already assumes replies can look different depending on the situation, so nothing extra was required.

Two things that only show up when you actually run it

The nurse's clipboard has a trap on it. The health check isn't just "alive or dead," it can also say "alive, but busy," and it reports when that status last changed. I assumed, reasonably, that you'd stamp the current time on every single check-in. That's wrong, and AWS says so in fine print I only found after searching: if you keep stamping "just now" every time someone asks, the hotel thinks something is still actively happening in the room, forever, and never lets the room go idle. The guest never checks out. The room sits there burning your budget. I built a version of my code that makes this exact mistake on purpose and confirmed it: flip a switch to break the timestamp, and that one thing fails while everything else keeps passing.

A local check lied to me, too. My type checker said the code was fine, no errors. Then I tried to actually package it into a lunchbox and it refused, with an error about not knowing where to put the finished files. The type checker only checks whether the code makes sense; it never actually writes anything to disk, so it never noticed I'd forgotten to tell it where "disk" was. The moment a step tries to really produce files, the same code that "passed" suddenly doesn't.

Actually shipping it

Local testing is one thing. I also pushed the Hono lunchbox to real AWS and rented a real room.

First attempt, denied. I tried reusing a set of keys I already had from another project, and the hotel said no — that particular keyring only opens one specific storage closet, and it wasn't this one. Sensible, in hindsight; I just hadn't looked closely enough before assuming I could reuse it. I cut a fresh keyring scoped to only this project's closet, and the second attempt worked.

Once it was running, I noticed something I hadn't expected. Every new guest ID starts an entirely new room from scratch. I called the hotel 14 times with 14 different guest IDs and found 14 fresh room logs, each one starting from "just opened the door," meaning the AI process itself had restarted every single time. Call it again with the same guest ID, though, and it walks back into the room that's still warm. The very first call after deployment took about 5 to 7 seconds, most of that AWS actually fetching my lunchbox off the shelf for the first time. Every call after that, reusing the same guest ID, added only about a tenth of a second of hotel overhead on top of whatever my AI itself took to think.

And the phone call worked too. WebSocket has its own separate front door at the hotel, not the same one as the regular doorbell, and you have to sign your knock with a security signature before it'll let you in. Once I did that, messages went back and forth in real time, exactly like Express or FastAPI would have handled it. One quirk: the room's internal log recorded the phone call as a normal, everyday response, even though from outside the hotel it looked like the special "switching to a phone call" response. That's not a bug — it's just that the phone-call wiring lives one layer below where my own logging code was watching, so my code only ever saw things from where it was standing.

What I'd tell someone starting this

If you came here hoping for "Hono is 3x faster, switch immediately" — it isn't, and I won't pretend it is. The size and speed numbers were close enough that they shouldn't be your reason to pick anything.

What should be your reason: how much of the plumbing you're expected to build yourself versus how much the framework already assumes. Express made me build my own WebSocket door. FastAPI made me argue with its own front desk before it would even open. Hono just... answered the door, in whatever shape I needed, without an argument.

Which, now that I think about it, is a pretty fitting way for something named after a flame to behave. It doesn't need much kindling. It just needs a little air, and it's already going.

Top comments (0)