HTTP API
Test Without a Port
Exercise Studio routes with fetch without starting a server.
Use .fetch(...) when testing Studio wiring. This calls the same Hono app as the served runtime without opening a local port.
import { Studio } from "@anvia/studio";
const studio = new Studio([agent]);
const response = await studio.fetch(
new Request("http://studio.test/agents/support/runs", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ message: "Hello" }),
}),
);
const body = await response.json();Use this for route-level tests around registered agents, run request shape, sessions, approvals, questions, and knowledge inspection.
const config = await studio.fetch(new Request("http://studio.test/config"));
expect(config.status).toBe(200);Call .start(...) only when you need the browser UI or a real HTTP listener.
