@agentskit/react

中文文档
0.8.10发布于 2026/10/10MITTypeScriptESM + CJS构建来源已验证近 30 天下载 4643

React hooks and UI components for AgentsKit.

原始使用文档
文档目录13 节
  1. Verified proof
  2. How this fits the ecosystem
  3. Why react
  4. Install
  5. Quick example
  6. Features
  7. Other framework bindings (shared state/action contract)
  8. Ecosystem
  9. Contributors
  10. License
  11. Docs
  12. Maturity and compatibility
  13. Contributing

@agentskit/react

Profile: major-package

AgentsKit

Add streaming AI chat to any React app in 10 lines of code.

npm version npm downloads bundle size license stability GitHub stars

Tags: ai · agents · llm · agentskit · openai · anthropic · claude · gemini · chatgpt · react · react-hooks · chat-ui · ai-agents

Verified proof

How this fits the ecosystem

@agentskit/react is the React UI layer: hooks and headless components for streaming chat, tool calls, memory, and agent-facing interfaces.

  • AgentsKit: compose it with the other packages in this repo to build agents from small, swappable parts.
  • Registry: look for ready agents and templates that already use this layer at registry.agentskit.io.
  • Playbook: learn the production patterns behind this layer at playbook.agentskit.io.

Docs: package guide · agent handoff

Why react

  • Ship faster — streaming chat with tool calls and memory works out of the box; Markdown is a raw content slot for your chosen renderer
  • Works with your design system — completely headless; style it with Tailwind, MUI, shadcn, or plain CSS via data-ak-* attributes
  • Agent-ready by default — built-in support for tool calls, thinking indicators, and multi-turn memory so you never hit a wall as your product grows
  • Swap providers in one line — pass any adapter from @agentskit/adapters; your component code never changes

Install

npm install @agentskit/react @agentskit/adapters

Quick example

import { useChat, ChatContainer, Message, InputBar } from '@agentskit/react'
import { anthropic } from '@agentskit/adapters'
import '@agentskit/react/theme'

export function Chat() {
  const chat = useChat({
    adapter: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, model: 'claude-sonnet-4-6' }),
  })
  return (
    <ChatContainer>
      {chat.messages.map(msg => <Message key={msg.id} message={msg} />)}
      <InputBar chat={chat} />
    </ChatContainer>
  )
}

Features

  • useChat hook — streaming, abort, tool calls, memory, and skills in one API
  • Headless components: ChatContainer, Message, InputBar, ToolCallView, ThinkingIndicator
  • InputBar blocks form submit and Enter while chat.status === 'streaming' (and when disabled)
  • ToolCallView toggle exposes aria-expanded for assistive tech
  • data-ak-* attributes for styling — zero hardcoded styles, full design-system control
  • Theme via @agentskit/react/theme — opt-in CSS variables, override per component
  • Works with React 18 and 19

Other framework bindings (shared state/action contract)

Every binding adapts the shared ChatReturn state/action contract. Pick the one for your stack; component props and host state shapes remain framework-specific:

PackageAPI
@agentskit/vueuseChat composable + ChatContainer component
@agentskit/sveltecreateChatStore — Svelte 5 store
@agentskit/soliduseChat hook (Solid createStore)
@agentskit/react-nativeuseChat (Metro / Hermes safe)
@agentskit/angularAgentskitChat service (Signal + RxJS)
@agentskit/inkTerminal useChat + components

Ecosystem

PackageRole
@agentskit/coreChat controller types, events
@agentskit/adaptersanthropic, openai, ollama, …
@agentskit/runtimeSame stack without a browser
@agentskit/toolsTool definitions for useChat

Contributors

AgentsKit contributors

License

MIT — see LICENSE.

Docs

Full documentation · GitHub

Maturity and compatibility

  • Stability: beta — see docs/STABILITY.md
  • Node.js 20+ and TypeScript strict mode
  • Published as @agentskit/react

Contributing

See CONTRIBUTING.md and the monorepo LICENSE.

版本与发布记录

@agentskit/react 共发布 38 个版本,首次发布于 2026/04/06;过去 12 个月发布了 38 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.10latest2026/10/1028 天前
0.8.92026/10/031 个月前
0.8.82026/10/031 个月前
0.8.72026/09/291 个月前
0.8.62026/09/261 个月前
0.8.52026/09/171 个月前

关于 @agentskit/react 的常见问题

@agentskit/react 是什么?

React hooks and UI components for AgentsKit.

如何安装 @agentskit/react?

在项目目录运行 npm install @agentskit/react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.0.0)、react-dom(>=18.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@agentskit/react 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agentskit/react 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@agentskit/react 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.19。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@agentskit/react 可以商用吗?

@agentskit/react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agentskit/react 的下载量有多少?

根据 npm 官方下载统计,@agentskit/react 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,643 次,日均约 155 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agentskit/react 还在维护吗?

最新版本 0.8.10 发布于 2026/10/10(28 天前);至今共发布 38 个版本,其中过去 12 个月发布了 38 个;首次发布于 2026/04/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。