oyadotai-server
v0.1.13
Published
Fetch-API server helpers for oya agents (SSE / text streaming).
Readme
oyadotai-server
Fetch-API server helpers for oyadotai agents - turn an agent's stream into a Response on any Fetch-based runtime (Bun, Next.js route handlers, Cloudflare Workers, the edge).
bun add oyadotai oyadotai-serverimport { toSSEResponse, toTextResponse } from "oyadotai-server";
// In any Fetch handler (Next.js route, Bun.serve, a Worker):
export async function POST(req: Request) {
const { prompt } = await req.json();
return toSSEResponse(agent.stream(prompt)); // structured plan events over SSE
// or: return toTextResponse(agent.stream(prompt)); // plain text stream
}toSSEResponse emits the structured plan events (usePlan / useChat in oyadotai/react consume them); toTextResponse emits the final answer as a text stream.
See the main README for the full picture.
License
MIT © Oya Labs, Inc.
