-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
docs(server-hono): add README with usage and configuration reference #1351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nuthalapativarun
wants to merge
2
commits into
VoltAgent:main
Choose a base branch
from
nuthalapativarun:docs/server-hono-readme
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@voltagent/server-hono": patch | ||
| --- | ||
|
|
||
| Add README documentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| <div align="center"> | ||
| <a href="https://voltagent.dev/"> | ||
| <img width="1500" height="276" alt="voltagent" src="https://github.com/user-attachments/assets/d9ad69bd-b905-42a3-81af-99a0581348c0" /> | ||
| </a> | ||
|
|
||
| <h3 align="center"> | ||
| AI Agent Engineering Platform | ||
| </h3> | ||
|
|
||
| <div align="center"> | ||
| <a href="https://voltagent.dev">Home Page</a> | | ||
| <a href="https://voltagent.dev/docs/">Documentation</a> | | ||
| <a href="https://github.com/voltagent/voltagent/tree/main/examples">Examples</a> | ||
| </div> | ||
| </div> | ||
|
|
||
| <br/> | ||
|
|
||
| <div align="center"> | ||
|
|
||
| [](https://github.com/voltagent/voltagent/issues) | ||
| [](https://github.com/voltagent/voltagent/pulls) | ||
| [](https://opensource.org/licenses/MIT) | ||
| [](https://www.npmjs.com/package/@voltagent/server-hono) | ||
| [](https://www.npmjs.com/package/@voltagent/server-hono) | ||
| [](https://s.voltagent.dev/discord) | ||
|
|
||
| </div> | ||
|
|
||
| ## @voltagent/server-hono | ||
|
|
||
| The default VoltAgent server adapter, built on [Hono](https://hono.dev/). It wires up the routes, handlers, WebSocket support, and OpenAPI/Swagger UI provided by [`@voltagent/server-core`](https://github.com/VoltAgent/voltagent/tree/main/packages/server-core) into a runnable HTTP server. | ||
|
|
||
| --- | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| npm install @voltagent/server-hono | ||
| # or | ||
| yarn add @voltagent/server-hono | ||
| # or | ||
| pnpm add @voltagent/server-hono | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```typescript | ||
| import { VoltAgent, Agent } from "@voltagent/core"; | ||
| import { honoServer } from "@voltagent/server-hono"; | ||
| import { openai } from "@ai-sdk/openai"; | ||
|
|
||
| const agent = new Agent({ | ||
| name: "my-agent", | ||
| instructions: "A helpful assistant", | ||
| model: openai("gpt-4o-mini"), | ||
| }); | ||
|
|
||
| new VoltAgent({ | ||
| agents: { agent }, | ||
| server: honoServer(), | ||
| }); | ||
| ``` | ||
|
|
||
| This starts an HTTP server exposing the agent/workflow/tool/memory/observability routes defined in `@voltagent/server-core`, along with a Swagger UI for exploring the API. | ||
|
|
||
| ## Configuration | ||
|
|
||
| `honoServer(config)` accepts a `HonoServerConfig`: | ||
|
|
||
| | Option | Type | Default | Description | | ||
| | ----------------- | ------------------------------ | --------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `port` | `number` | `3141` | Port to listen on | | ||
| | `hostname` | `string` | `"0.0.0.0"` | Hostname to bind the server to | | ||
| | `cors` | `CORSOptions \| false` | allows all origins | CORS configuration, or `false` to disable default CORS | | ||
| | `enableSwaggerUI` | `boolean` | `true` in development | Enable the `/ui` Swagger UI route | | ||
| | `resumableStream` | `{ adapter, defaultEnabled? }` | — | Configure a [`@voltagent/resumable-streams`](https://github.com/VoltAgent/voltagent/tree/main/packages/resumable-streams) adapter | | ||
| | `configureApp` | `(app: Hono) => void` | — | Register custom routes/middleware directly on the Hono app | | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
| | `auth` | `AuthProvider` | — | Authentication provider for protecting execution endpoints. **Deprecated** — use `authNext` instead | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: README contains conflicting auth guidance: the configuration table marks Prompt for AI agents |
||
| | `authNext` | `AuthNextConfig` | — | Next-gen authentication policy. All routes are protected by default; configure `publicRoutes` and console access via the config | | ||
|
|
||
| ```typescript | ||
| new VoltAgent({ | ||
| agents: { agent }, | ||
| server: honoServer({ | ||
| port: 8080, | ||
| cors: { | ||
| origin: "https://example.com", | ||
| allowMethods: ["GET", "POST", "OPTIONS"], | ||
| }, | ||
| configureApp: (app) => { | ||
| app.get("/healthz", (c) => c.text("ok")); | ||
| }, | ||
| }), | ||
| }); | ||
| ``` | ||
|
|
||
| ## Authentication | ||
|
|
||
| `jwtAuth` provides a ready-to-use JWT `AuthProvider`: | ||
|
|
||
| ```typescript | ||
| import { jwtAuth } from "@voltagent/server-hono"; | ||
|
|
||
| const auth = jwtAuth({ | ||
| secret: process.env.JWT_SECRET, | ||
| }); | ||
|
|
||
| new VoltAgent({ | ||
| agents: { agent }, | ||
| server: honoServer({ auth }), | ||
| }); | ||
| ``` | ||
|
|
||
| ## Custom Endpoints & App Factory | ||
|
|
||
| - `extractCustomEndpoints`, `getEnhancedOpenApiDoc` — helpers for registering custom routes and extending the generated OpenAPI document. | ||
| - `createVoltAgentApp` — builds the underlying Hono app instance for embedding into existing Node.js servers (e.g. NestJS, Express) instead of using `honoServer` directly. | ||
|
|
||
| ```typescript | ||
| import { createVoltAgentApp } from "@voltagent/server-hono"; | ||
| import type { ServerProviderDeps } from "@voltagent/core"; | ||
|
|
||
| // `deps` is the ServerProviderDeps object passed in by VoltAgent (agents, workflows, etc.) | ||
| // `config` is a HonoServerConfig — same options as honoServer() | ||
| // The function is async and returns { app } — a configured Hono instance | ||
|
|
||
| // Example: embed into an existing Node.js server | ||
| async function bootstrap(deps: ServerProviderDeps) { | ||
| const { app } = await createVoltAgentApp(deps, { | ||
| port: 3141, | ||
| enableSwaggerUI: false, | ||
| configureApp: (honoApp) => { | ||
| honoApp.get("/healthz", (c) => c.text("ok")); | ||
| }, | ||
| }); | ||
|
|
||
| // `app` is a plain Hono app — mount it, serve it, or pass it to your framework | ||
| return app; | ||
| } | ||
| ``` | ||
|
|
||
| ## Documentation | ||
|
|
||
| - [VoltAgent Documentation](https://voltagent.dev/docs/) | ||
| - [`@voltagent/server-core`](https://github.com/VoltAgent/voltagent/tree/main/packages/server-core) — the framework-agnostic server core this adapter builds on | ||
| - [Agent Overview](https://voltagent.dev/docs/agents/overview/) | ||
|
|
||
| ## License | ||
|
|
||
| Licensed under the MIT License, Copyright © 2026-present VoltAgent. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major
🧩 Analysis chain
🌐 Web query:
What is the correct GitHub organization URL for VoltAgent?💡 Result:
The correct GitHub organization URL for VoltAgent is https://github.com/VoltAgent [1]. This organization serves as the central hub for the VoltAgent AI Agent Engineering Platform, hosting its open-source TypeScript framework [2][1] and various related repositories [3][1].
Citations:
🏁 Script executed:
Repository: VoltAgent/voltagent
Length of output: 6580
Correct GitHub organization capitalization in all URLs.
The GitHub URLs use inconsistent capitalization for the organization name. Lines 13, 21, and 22 use lowercase
voltagent, while lines 32 and 127 useVoltAgent. The correct capitalization isVoltAgent(mixed case). Update all instances to:https://github.com/VoltAgent/voltagent/tree/main/exampleshttps://github.com/VoltAgent/voltagent🤖 Prompt for AI Agents