
Building Wukong: A Plug-and-Play AI Agent Library for Next.js
Date: November 12, 2025
Status: In Development
License: MIT (Free & Open Source)
What I'm Building
Wukong - A plug-and-play AI agent library for Next.js. Install it, provide your API key, knowledge base, and tools, and you have a working agent in 5 minutes.
npm install @wukong/agent
const agent = new WukongAgent({
llmKey: process.env.OPENAI_API_KEY,
knowledgeBase: './docs',
tools: './tools'
})
await agent.execute({
goal: "Analyze sales data and generate report"
})
That's it. No complex framework to learn. No agent architecture to design. Just plug and play.
Why I'm Building This
1. Native Next.js Integration
If you can write Next.js, you can use Wukong. No new concepts, no new frameworks. It's designed specifically for Next.js developers who want to add AI agent capabilities to their apps.
2. Focus on Your Moat, Not Framework
Stop wasting time learning LangChain/LlamaIndex to build agent infrastructure. Your competitive advantage is your knowledge base and tools, not your agent framework.
With Wukong:
- ❌ Don't spend months building: multi-step reasoning, error recovery, state management, token optimization
- ✅ Do spend time on: your domain knowledge, your tools, your user experience
3. Trustworthy, Not Just Smart
This isn't another "clever" agent that does unpredictable things. Wukong is designed for production with:
- Visibility - Real-time progress, complete transparency
- Control - Stop anytime, confirm risky operations
- Reversibility - Undo/rollback any action
- Token Efficiency - 98% savings through MCP pattern, lazy loading, smart discarding
It's an agent you can actually trust in production.
4. Free & Open Source
MIT licensed. Save months of development time, $0 cost. Your LLM keys, your data, your control.
Want more practical breakdowns like this?
Once or twice a month, I share one useful breakdown on AI agents, software engineering, or an experiment I am actually running—often with code, checklists, or templates.
Free. No spam. Unsubscribe anytime.
Read a sample article →Key Technical Innovation: Token Efficiency
Traditional frameworks waste tokens massively:
- Every tool call = full schema (thousands of tokens)
- Loading 50 skills = 150K tokens
- Long tasks = linear growth
Wukong's solution:
- MCP Schema Caching - Cache schemas locally, LLM only sends tool name + params → 98% savings
- Lazy Loading - Only load matched skills documentation → 98% savings
- Smart Discarding - LLM marks discardable steps → 60-80% savings
Result: Handle hundreds of steps without exploding costs.
Trustworthiness Features: Complete Implementation of 30 Principles
From "smart" to "trustworthy"—this is Wukong's core design philosophy. We've implemented all 30 trustworthiness principles to ensure the agent runs reliably in production.
Complete Feature Checklist
| # | Trustworthy Principle | Core Library | UI Component Package | Completeness |
|---|---|---|---|---|
| Startup Phase | ||||
| 1 | Clearly list what can/cannot do | ✅ getCapabilities() | ✅ <CapabilitiesPanel> | 100% |
| 2 | Skill tree/tag display | ✅ Skills Registry | ✅ <SkillsTree> | 100% |
| 3 | Example commands | ✅ Configuration option | ✅ <ExamplePrompts> | 100% |
| 4 | New feature notification | ✅ Version API | ✅ <UpdateBanner> | 100% |
| 5 | Mark information sources | ✅ Returns with source | ✅ Auto-mark | 100% |
| Before Execution | ||||
| 6 | Generate draft | ✅ onPlanReady | ✅ <PlanPreview> | 100% |
| 7 | Sidebar/modal | ✅ Event system | ✅ <Sidebar> <Modal> | 100% |
| 8 | Accept/edit options | ✅ callback | ✅ <ActionButtons> | 100% |
| 9 | Display execution plan | ✅ plan:generated | ✅ <ExecutionPlan> | 100% |
| 10 | Expandable checklist | ✅ Todo List | ✅ <TodoList> | 100% |
| 11 | Real-time outline display | ✅ streaming | ✅ <ThinkingBox> | 100% |
| During Execution | ||||
| 12 | Real-time status display | ✅ step:started | ✅ <StatusIndicator> | 100% |
| 13 | Progress bar/counter | ✅ progress event | ✅ <ProgressBar> | 100% |
| 14 | Decision log | ✅ reasoning event | ✅ <DecisionLog> | 100% |
| 15 | Reasoning process | ✅ streaming | ✅ Auto-display | 100% |
| 16 | Notify cost | ✅ tokens:used | ✅ <CostIndicator> | 100% |
| 17 | Answer with "why" | ✅ reasoning field | ✅ <WhyButton> | 100% |
| After Errors | ||||
| 18 | Undo function | ✅ undo() | ✅ <UndoButton> | 100% |
| 19 | Version history | ✅ checkpoint | ✅ <VersionHistory> | 100% |
| 20 | Sandbox simulation | ⚠️ Tool layer | ✅ <SandboxPreview> | 80% |
| 21 | Comparison view | ✅ diff data | ✅ <DiffView> | 100% |
| 22 | Stop button | ✅ stop() | ✅ <StopButton> | 100% |
| 23 | Human confirmation | ✅ Confirmation event | ✅ <ConfirmDialog> | 100% |
| 24 | Escalate to human | ✅ Error detection | ✅ <EscalateButton> | 100% |
| New Loop | ||||
| 25 | Long-term memory selection | ✅ Configuration option | ✅ <MemorySettings> | 100% |
| 26 | One-click restart | ✅ redoStep() | ✅ <RetryButton> | 100% |
| 27 | Thumbs up/down feedback | ✅ Feedback API | ✅ <FeedbackButtons> | 100% |
| 28 | Feedback form | ✅ Feedback API | ✅ <FeedbackForm> | 100% |
| 29 | Task completion rate | ✅ Statistics API | ✅ <MetricsDashboard> | 100% |
| 30 | Trust index | ✅ Calculation API | ✅ <TrustScore> | 100% |
Complete Support Rate: 30/30 (100%) ✅
Two Packages Work Together
@wukong/agent - Core Engine and API
Provides all underlying capabilities and event system: Agent controller, Session management, History and checkpoints, Event emitter, Tool execution, Knowledge Base.
@wukong/agent-ui - Ready-to-Use React Components
Provides complete UI components: Complete chat interface, Individual composable components, React Hooks, Theme system, Responsive design.
Learn more about trustworthiness design: From Smart to Trustworthy: Management Guide to AI Agents
What's Public
Everything is on GitHub:
- All code in
/packages/ - Complete design docs in
/docs/design/ - Implementation plan with detailed steps
- Progress updates as I ship each phase
Get Involved
Use Cases: What would you build with this?
Feedback: What's missing? What's wrong?
Contribute: It's open source—PRs welcome
Success = Developers integrate in 5 minutes, trust it in production, build complex multi-step apps without token explosion.
Links:
- GitHub: [https://github.com/Moonveil-AI/wukong]
- Twitter/X: [https://x.com/sv_cloud_expert]
- Author Website: [https://shanhuang.net]
#BuildInPublic #AIAgents #OpenSource #NextJS #TypeScript
Get practical ideas worth using.
Once or twice a month, I share one useful breakdown on AI agents, software engineering, or an experiment I am actually running—often with code, checklists, or templates.
Free. No spam. Unsubscribe anytime.
Read a sample article →