Quickstart
Build a streaming, tool-calling agent and serve it over HTTP in a few minutes.
1. Create a project
Terminal
npm create redtuma@latest my-agent
cd my-agent
npm install2. Add your model key
Redtuma reads provider keys from the environment.
Terminal
export ANTHROPIC_API_KEY=sk-ant-...3. Define an agent
src/index.ts
import { Redtuma } from '@redtuma/core'
import { Agent } from '@redtuma/core/agent'
import { createTool } from '@redtuma/core/tools'
import { z } from 'zod'
const getWeather = createTool({
id: 'get-weather',
description: 'Get weather for a city',
inputSchema: z.object({ city: z.string() }),
execute: async ({ context }) => ({ tempC: 21, city: context.city }),
})
export const agent = new Agent({
id: 'assistant',
instructions: 'You are a concise weather assistant.',
model: 'anthropic/claude-opus-4-8',
tools: { getWeather },
})
export const redtuma = new Redtuma({ agents: { assistant: agent } })4. Run it
generate / stream
const res = await agent.generate('What is the weather in Taipei?')
console.log(res.text)
// or stream tokens
const stream = await agent.stream('And London?')
for await (const chunk of stream.textStream) process.stdout.write(chunk)5. Serve over HTTP
createHonoServer exposes every registered agent and workflow as JSON routes such as POST /api/agents/:id/generate.
src/server.ts
import { serve } from '@hono/node-server'
import { createHonoServer } from '@redtuma/deployer'
import { redtuma } from './index'
serve({ fetch: createHonoServer(redtuma).fetch, port: 3000 })Terminal
curl -X POST http://localhost:3000/api/agents/assistant/generate \
-H 'content-type: application/json' \
-d '{ "input": "Weather in Taipei?" }'Going to the edge?
Scaffold with
--template cloudflare to get a Worker with Durable Object memory and a one-command wrangler deploy. See Cloudflare.