PAIPAI

@pai/core

Backend agent definitions, backend tools, and runtime APIs.

@pai/core is the backend runtime package. It defines agents, backend tools, lifecycle hooks, direct runtime clients, and trusted runtime/admin operations. HTTP serving lives in adapter packages such as @pai/hono, @pai/express, and @pai/receiver-http.

pnpm add @pai/core ai zod

Exports

APIPurpose
defineAgent()Define the server-side agent contract and behavior.
RunMetadataSchemasDescribe typed server-only and client-readable metadata for each run.
AgentLifecycleCustomize run setup, model steps, tool calls, and canonical output.
defineTool()Define backend tools, client-routed tools, and suspend/resume tools.
createAgentRuntime()Create an in-process runtime without HTTP.

Do not import @pai/core from browser UI code. Browser HTTP clients should use @pai/client-http, lower-level custom transports should use @pai/client, and React apps should use @pai/react.

On this page