人類應用。零壁壘。只寫一次應用合約。人類透過瀏覽器使用,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