@kortyx/agent
v0.14.1
Published
Agent composition utilities for Kortyx.
Maintainers
Readme
@kortyx/agent
Agent creation, chat route handlers, HTTP helpers, and stream orchestration for Kortyx.
Most application code should import these APIs from kortyx. Use @kortyx/agent directly when you are building framework adapters or want the lower-level agent package without the full facade.
Install
pnpm add @kortyx/agentnpm install @kortyx/agentKey APIs
createAgent(...)createChatRouteHandler(...)handleChatRequestBody(...)parseChatRequestBody(...)streamChatFromRoute(...)streamChat(...)transformGraphStreamForUI(...)
Example
import { createAgent, createChatRouteHandler } from "@kortyx/agent";
import { defineWorkflow } from "@kortyx/core";
const workflow = defineWorkflow({
id: "general-chat",
version: "1.0.0",
nodes: {
answer: {
run: async ({ input }) => ({ ui: { message: String(input ?? "") } }),
},
},
edges: [
["__start__", "answer"],
["answer", "__end__"],
],
});
const agent = createAgent({
workflows: [workflow],
defaultWorkflowId: "general-chat",
});
export const handleChat = createChatRouteHandler({ agent });Documentation
License
Apache-2.0. See LICENSE.
