Route Context

Docs

Route context is the object your Hono handler receives for one request. It carries the incoming request, lets you read Agentuity services from c.var.*, and gives you the boundary where route code calls shared app logic. Start here to see what lives in the framework context. Use the buttons below to inspect one part at a time, then compare the response with the code on the right.

Response

Waiting for request
Reference Code
import { agentuity } from "@agentuity/hono";
import type { Logger, Services } from "@agentuity/hono";
import { Hono } from "hono";

type Variables = Pick<Services, "kv" | "queue" | "stream" | "vector"> & {
  logger: Logger;
};

const app = new Hono<{ Variables: Variables }>();
// Register once at the app boundary, then read only the helpers each route needs.
app.use("*", agentuity());

app.get("/api/context", async (c) => {
  const requestId = crypto.randomUUID();

  c.var.logger.info("Context inspected", {
    requestId,
    path: c.req.path,
  });

  await c.var.kv.set("request-inspection", requestId, {
    method: c.req.method,
    userAgent: c.req.header("user-agent") ?? "unknown",
  }, { ttl: 300 });

  return c.json({
    requestId,
    available: {
      logger: "c.var.logger",
      keyValue: "c.var.kv",
      vector: "c.var.vector",
      queues: "c.var.queue",
      durableStreams: "c.var.stream",
    },
  });
});

export default app;
Ready
Output will appear here...