微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🤖

React AI 对话界面即插即用方案

agent-ui · vv0.1.5
开发 安全 A 级 作者 okaris 公开目录收录
4.2k 下载 863 安装 20.9k 收藏 8.7k 浏览

简介

inference.sh 出品的 React/Next.js AI Agent 组件,集成运行时、工具链与审批流,让开发者快速构建企业级聊天界面与 SaaS 副驾驶。

原始描述

Batteries-included agent component for React/Next.js from ui.inference.sh. One component with runtime, tools, streaming, approvals, and widgets built in. Cap...

通过你的 Agent 添加

安装目录:agent-ui/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/agent-ui/
Codex CLI~/.codex/skills/agent-ui/
DeepSeek Harness~/.agents/skills/agent-ui/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

agent-ui 是由 inference.sh 提供的 一站式 React Agent UI 组件,主打「零后端逻辑」即可运行完整 AI 助手界面。开发者通过 npx shadcn add 安装组件后,只需配置代理路由与 API Key,即可在 Next.js 项目中获得具备流式输出、工具生命周期管理、人机协作审批、JSON Widgets 渲染等能力的交互界面。

组件采用声明式配置:通过 agentConfig 指定模型(如 OpenRouter)、系统提示词和工具集;proxyUrl 指向本地代理路由,将请求转发至 inference.sh 服务。支持客户端工具(createScopedTools)实现浏览器端表单填充等交互。

显著优点

  • 开箱即用:封装运行时、工具状态机、UI 渲染,减少 80% 的胶水代码
  • 人机协作内置:pending → progress → approval → results 完整工具生命周期,支持人工审批节点
  • 流式体验:原生支持 token 级流式输出,无需额外 SSE 处理
  • Client-Side 工具:工具函数可在浏览器执行,降低服务端成本,支持表单扫描与自动填充
  • Widgets 系统:Agent 返回 JSON 即可渲染声明式 UI,实现动态界面生成

潜在局限

  • 外部 SaaS 依赖:核心服务托管于 ui.inference.sh,需持续联网,存在服务可用性风险
  • Next.js 锁定:代理路由与示例代码深度绑定 Next.js App Router,其他框架需自行适配
  • 黑盒运行时:内部工具调度、上下文管理逻辑未开源,深度定制受限
  • 成本不透明:依赖 inference.sh API,调用成本与定价策略需单独确认

适合人群

  • 需要快速验证 AI 助手原型的创业团队/独立开发者
  • 已使用 Next.js + shadcn/ui 技术栈的前端工程师
  • 希望减少后端投入的 SaaS 产品团队

常规风险

  • API Key 管理:INFERENCE_API_KEY 需妥善存储,避免前端暴露
  • 数据出境:请求经 inference.sh 代理转发,需评估是否符合数据合规要求
  • 供应链安全:依赖 @inferencesh/sdk 及 npm 生态,建议锁定版本并审计依赖
  • 供应商锁定:工具定义、配置格式与 inference.sh 深度绑定,迁移成本较高

技能正文


name: agent-ui description: "Batteries-included agent component for React/Next.js from ui.inference.sh. One component with runtime, tools, streaming, approvals, and widgets built in. Capabilities: drop-in agent, human-in-the-loop, client-side tools, form filling. Use for: building AI chat interfaces, agentic UIs, SaaS copilots, assistants. Triggers: agent component, agent ui, chat agent, shadcn agent, react agent, agentic ui, ai assistant ui, copilot ui, inference ui, human in the loop"

Install the belt CLI skill: npx skills add belt-sh/cli

Agent Component

Batteries-included agent component from ui.inference.sh.

Agent Component

Quick Start

# Install the agent component
npx shadcn@latest add https://ui.inference.sh/r/agent.json

# Add the SDK for the proxy route
npm install @inferencesh/sdk

Setup

1. API Proxy Route (Next.js)

// app/api/inference/proxy/route.ts
import { route } from '@inferencesh/sdk/proxy/nextjs';
export const { GET, POST, PUT } = route;

2. Environment Variable

# .env.local
INFERENCE_API_KEY=inf_...

3. Use the Component

import { Agent } from "@/registry/blocks/agent/agent"

export default function Page() {
  return (
    <Agent
      proxyUrl="/api/inference/proxy"
      agentConfig={{
        core_app: { ref: 'anthropic/claude-haiku-5-5@latest' },
        description: 'a helpful ai assistant',
        system_prompt: 'you are helpful.',
      }}
    />
  )
}

Features

Feature Description
Runtime included No backend logic needed
Tool lifecycle Pending, progress, approval, results
Human-in-the-loop Built-in approval flows
Widgets Declarative JSON UI from agent responses
Streaming Real-time token streaming
Client-side tools Tools that run in the browser

Client-Side Tools Example

import { Agent } from "@/registry/blocks/agent/agent"
import { createScopedTools } from "./blocks/agent/lib/client-tools"

const formRef = useRef<HTMLFormElement>(null)
const scopedTools = createScopedTools(formRef)

<Agent
  proxyUrl="/api/inference/proxy"
  config={{
    core_app: { ref: 'anthropic/claude-haiku-5-5@latest' },
    tools: scopedTools,
    system_prompt: 'You can fill forms using scan_ui and fill_field tools.',
  }}
/>

Props

Prop Type Description
proxyUrl string API proxy endpoint
name string Agent name (optional)
config AgentConfig Agent configuration
allowFiles boolean Enable file uploads
allowImages boolean Enable image uploads

Related Skills

# Chat UI building blocks
npx skills add inference-sh/skills@chat-ui

# Declarative widgets from JSON
npx skills add inference-sh/skills@widgets-ui

# Tool lifecycle UI
npx skills add inference-sh/skills@tools-ui

Documentation

Component docs: ui.inference.sh/blocks/agent

正文来自原始仓库, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/101-skills/skills

标签

frontendreactdevelopment-engineeringaichatbotui-component

同类 Skill