← Back to Blog
Building Wukong: A Plug-and-Play AI Agent Library for Next.js

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:

  1. MCP Schema Caching - Cache schemas locally, LLM only sends tool name + params → 98% savings
  2. Lazy Loading - Only load matched skills documentation → 98% savings
  3. 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 PrincipleCore LibraryUI Component PackageCompleteness
Startup Phase
1Clearly list what can/cannot dogetCapabilities()<CapabilitiesPanel>100%
2Skill tree/tag display✅ Skills Registry<SkillsTree>100%
3Example commands✅ Configuration option<ExamplePrompts>100%
4New feature notification✅ Version API<UpdateBanner>100%
5Mark information sources✅ Returns with source✅ Auto-mark100%
Before Execution
6Generate draftonPlanReady<PlanPreview>100%
7Sidebar/modal✅ Event system<Sidebar> <Modal>100%
8Accept/edit options✅ callback<ActionButtons>100%
9Display execution planplan:generated<ExecutionPlan>100%
10Expandable checklist✅ Todo List<TodoList>100%
11Real-time outline display✅ streaming<ThinkingBox>100%
During Execution
12Real-time status displaystep:started<StatusIndicator>100%
13Progress bar/counter✅ progress event<ProgressBar>100%
14Decision log✅ reasoning event<DecisionLog>100%
15Reasoning process✅ streaming✅ Auto-display100%
16Notify costtokens:used<CostIndicator>100%
17Answer with "why"✅ reasoning field<WhyButton>100%
After Errors
18Undo functionundo()<UndoButton>100%
19Version history✅ checkpoint<VersionHistory>100%
20Sandbox simulation⚠️ Tool layer<SandboxPreview>80%
21Comparison view✅ diff data<DiffView>100%
22Stop buttonstop()<StopButton>100%
23Human confirmation✅ Confirmation event<ConfirmDialog>100%
24Escalate to human✅ Error detection<EscalateButton>100%
New Loop
25Long-term memory selection✅ Configuration option<MemorySettings>100%
26One-click restartredoStep()<RetryButton>100%
27Thumbs up/down feedback✅ Feedback API<FeedbackButtons>100%
28Feedback form✅ Feedback API<FeedbackForm>100%
29Task completion rate✅ Statistics API<MetricsDashboard>100%
30Trust 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:

#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 →