hono

The Hono adapter creates HTTP applications from agent runtimes using the Hono framework.

Installation

bun add @regent/hono hono

Basic Usage

import { createAgent } from '@regent/core';
import { http } from '@regent/http';
import { createAgentApp } from '@regent/hono';
import { z } from 'zod';

const agent = await createAgent({
  name: 'my-agent',
  version: '1.0.0',
})
  .use(http())
  .addEntrypoint({
    key: 'echo',
    input: z.object({ text: z.string() }),
    handler: async ({ input }) => ({
      output: { echoed: input.text },
    }),
  })
  .build();

const { app, addEntrypoint } = await createAgentApp(agent);

Bun.serve({ fetch: app.fetch, port: 3000 });

API Reference

createAgentApp()

Creates a Hono application from an AgentRuntime.

Requirements: Runtime must have HTTP extension enabled via .use(http())

CreateAgentAppOptions

Return Value

Routes

Method
Path
Description

GET

/health

Health check

GET

/entrypoints

List entrypoints

GET

/.well-known/agent.json

Agent manifest

GET

/.well-known/agent-card.json

Agent card

GET

/favicon.svg

Favicon

GET

/

Landing page (if enabled)

POST

/entrypoints/{key}/invoke

Invoke entrypoint

POST

/entrypoints/{key}/stream

Stream entrypoint

POST

/tasks

Create task

GET

/tasks

List tasks

GET

/tasks/{taskId}

Get task

POST

/tasks/{taskId}/cancel

Cancel task

GET

/tasks/{taskId}/subscribe

Subscribe to task (SSE)

Middleware Hooks

Dynamic Entrypoints

Payment Integration

With the payments extension, priced entrypoints are automatically protected:

withPayments()

Manually apply payment middleware:

Response Format

Invoke Response

Stream Response (SSE)

Error Responses

Exports

Last updated