JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 56
  • Score
    100M100P100Q74207F
  • License Apache-2.0

Agent composition utilities for Kortyx.

Package Exports

  • @kortyx/agent
  • @kortyx/agent/browser

Readme

@kortyx/agent

npm version CI License TypeScript

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/agent
npm install @kortyx/agent

Key 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.