人类应用。零壁垒。只写一次应用合约。人类通过浏览器使用它,AI 智能体通过工具操作它。智能体在每次运行中进化。
一个 defineAPI() 定义自动创建: HTTP JSON API (Hono), MCP 工具 (Claude Desktop), A2A 技能 (Google Agent-to-Agent), OpenAPI 3.1 规范.
import { defineAPI } from "@zauso-ai/capstan-core";
import { z } from "zod";
// One contract — humans use it via HTTP, agents via MCP/A2A
export const GET = defineAPI({
input: z.object({
status: z.enum(["open", "closed"]).optional(),
}),
output: z.object({
tickets: z.array(z.object({
id: z.string(),
title: z.string(),
status: z.string(),
})),
}),
description: "List support tickets",
capability: "read",
resource: "ticket",
async handler({ input }) {
return { tickets: await db.tickets.list(input) };
},
});agents/triage.tsimport { createSmartAgent } from "@zauso-ai/capstan-ai";
import { defineSkill } from "@zauso-ai/capstan-ai";
// Smart agent with 12 production features
const agent = createSmartAgent({
model: "claude-sonnet-4-20250514",
tools: [listTickets, assignTicket, resolveTicket],
skills: [triageSkill],
maxTurns: 20,
timeout: { total: 120_000, perTool: 30_000 },
budget: { maxTokens: 100_000 },
compression: { strategy: "sliding-window" },
});
// Skills give agents strategic guidance
const triageSkill = defineSkill({
name: "triage",
when: "ticket needs priority assessment",
strategy: "Check severity, customer tier, SLA deadline",
});defineAPI() 同时服务人类的 HTTP 和智能体的 MCP/A2A 工具。同一合约,零胶水代码。
createSmartAgent() 包含 12 项生产特性:压缩、降级、验证、超时、看门狗、预算。
defineSkill() 赋予智能体高层策略。不只是工具 — 是解决复杂问题的战略指导。
智能体从每次运行中学习。经验 → 策略 → 技能。随时间变得更聪明。
React SSR、文件路由、Drizzle ORM、选择性 hydration。人类应用所需的一切。
JWT、OAuth、DPoP、SPIFFE/mTLS、限流、CSRF。人类和智能体认证内置。
capstan verify --json。8 步验证级联。AI 智能体自我修正。
一次定义,HTTP、MCP、A2A、OpenAPI 同时可用。智能体自动发现你的应用。
| 功能 | Next.js | LangChain | Capstan |
|---|---|---|---|
| Web 与智能体之间的壁垒 | 🧱 | 🧱 | + |
| Multi-protocol (HTTP + MCP + A2A) | – | – | + |
| 智能体运行时 | – | + | + |
| 技能层 + 进化 | – | – | + |
| React SSR | + | – | + |
| File-based routing | + | – | + |
| 内置认证 (JWT + OAuth + API 密钥) | – | – | + |
| 内置数据库层 | – | – | + |
| AI TDD verifier | – | – | + |
| OpenAPI auto-generation | – | – | + |
| 长期记忆 | – | ~ | + |
| 策略引擎 + 审批工作流 | – | – | + |
+ 内置 ~ 部分 – 不可用 🧱 完全隔离 | 完整对比
bunx create-capstan-app my-agentimport { createSmartAgent } from "@zauso-ai/capstan-ai";
const agent = createSmartAgent({
model: "claude-sonnet-4-20250514",
tools: [listTickets, assignTicket],
skills: [triageSkill],
});bunx capstan dev
# MCP server auto-available for Claude Desktopbunx create-capstan-app my-appcd my-app && bunx capstan dev你的应用已上线,所有智能体端点就绪:
# Agent manifest
curl http://localhost:3000/.well-known/capstan.json
# OpenAPI spec
curl http://localhost:3000/openapi.json
# MCP server (for Claude Desktop / Cursor)
bunx capstan mcp@zauso-ai/capstan-ai 提供完整的智能体运行时。createSmartAgent() 用于生产智能体,defineSkill() 用于战略指导,自我进化从每次运行中学习。
import { createSmartAgent, defineSkill } from "@zauso-ai/capstan-ai";
// Production-ready agent with 12 built-in features
const agent = createSmartAgent({
model: "claude-sonnet-4-20250514",
tools: [searchDocs, createTicket, sendEmail],
skills: [customerSupport, escalation],
maxTurns: 30,
timeout: { total: 120_000, perTool: 30_000 },
budget: { maxTokens: 200_000 },
compression: { strategy: "sliding-window" },
fallback: { model: "claude-haiku-4" },
validation: { validateToolArgs: true },
watchdog: { maxConsecutiveErrors: 3 },
});
// Skills evolve from experience
const customerSupport = defineSkill({
name: "customer-support",
when: "user has a support question",
strategy: "Search docs first, then check ticket history, escalate if unresolved",
});
// Agent learns and improves over time
// Experience -> Strategy -> Skill -> Evolution