Files
Alem Tuzlak 68f9b8ad45 feat(examples): add runtime adapter examples for Express, Hono, Node, Deno, Elysia, and CF Workers
Example projects demonstrating the new fetch-based runtime adapters
across six server frameworks/runtimes.
2026-04-03 18:41:29 +02:00

25 lines
595 B
TypeScript

import express from "express";
import { CopilotRuntime, BuiltInAgent } from "@copilotkit/runtime/v2";
import { createCopilotExpressHandler } from "@copilotkit/runtime/v2/express";
const runtime = new CopilotRuntime({
agents: {
default: new BuiltInAgent({ model: "openai/gpt-5-mini" }),
},
});
const app = express();
app.use(
createCopilotExpressHandler({
runtime,
basePath: "/api/copilotkit",
}),
);
const port = Number(process.env.PORT ?? 4002);
app.listen(port, () => {
console.log(
`Express runtime listening on http://localhost:${port}/api/copilotkit`,
);
});