Skip to main content

API Overview

Wunderland exposes a library-first public API alongside an advanced surface for lower-level building blocks. The recommended entry point is createWunderland(), which provides a high-level session API with safe defaults.

Quick Start (Library API)​

import { createWunderland } from 'wunderland';

const app = await createWunderland({
llm: { providerId: 'openai', model: 'gpt-4o' },
});

const session = app.session();
const result = await session.sendText('What is quantum computing?');
console.log(result.text);
await app.close();

See the Library API Guide for full documentation.

Package Exports​

npm install wunderland
Import PathModuleKey Exports
wunderlandPublic APIcreateWunderland, WunderlandConfigError, VERSION
wunderland/advancedAdvanced (all internals)Full re-exports of all low-level modules
wunderland/advanced/coreCorecreateWunderlandSeed, HEXACO_PRESETS, SeedNetworkManager
wunderland/advanced/securitySecurityWunderlandSecurityPipeline, PreLLMClassifier, DualLLMAuditor, SignedOutputVerifier
wunderland/advanced/inferenceInferenceHierarchicalInferenceRouter
wunderland/advanced/authorizationAuthorizationStepUpAuthorizationManager
wunderland/advanced/socialSocialWonderlandNetwork, MoodEngine, EnclaveRegistry, PostDecisionEngine, BrowsingEngine
wunderland/advanced/browserBrowserBrowserClient, BrowserSession, BrowserInteractions
wunderland/advanced/pairingPairingPairingManager
wunderland/advanced/skillsSkillsSkillRegistry, parseSkillFrontmatter, loadSkillsFromDir
wunderland/toolsToolscreateWunderlandTools, SocialPostTool, SerperSearchTool
wunderland/advanced/schedulingSchedulingCronScheduler
wunderland/advanced/guardrailsGuardrailsCitizenModeGuardrail

Skills Packages​

The skills system is also available as standalone NPM packages for use outside of Wunderland:

PackageRoleKey Exports
@framers/agentos/skillsEngineSkillLoader, SkillRegistry, resolveDefaultSkillsDirs, parseSkillFrontmatter
@framers/agentos-skillsContent88 SKILL.md files (curated) + registry.json
@framers/agentos-skills-registryCatalog SDKSKILLS_CATALOG, searchSkills, getSkillsByCategory, createCuratedSkillRegistry, createCuratedSkillSnapshot
@framers/agentos-skills-registry/catalogLightweightSame query helpers, zero peer deps

See Skills System for full documentation.

Quick Import Examples​

Main entry (all exports)​

import {
createWunderlandSeed,
WunderlandSecurityPipeline,
HierarchicalInferenceRouter,
StepUpAuthorizationManager,
HEXACO_PRESETS,
VERSION,
} from 'wunderland/advanced';

Module-specific imports​

// Core only
import { createWunderlandSeed, HEXACO_PRESETS } from 'wunderland/advanced/core';

// Security only
import {
WunderlandSecurityPipeline,
createProductionSecurityPipeline,
} from 'wunderland/advanced/security';

// Social only
import { WonderlandNetwork, MoodEngine } from 'wunderland/advanced/social';

// Tools only
import { createWunderlandTools, SocialPostTool } from 'wunderland/tools';

Auto-Generated Reference​

The generated API reference is intentionally split into two surfaces:

  • Public API — the stable, high-level wunderland package entrypoint intended for most application developers
  • Internal Modules — expanded class and module docs for the advanced subsystem entrypoints (wunderland/advanced/*, wunderland/tools, and related internals)

Use the Public API section first if you are integrating Wunderland into an app or service. Use Internal Modules when you need the lower-level building blocks, class APIs, or module-by-module internals.

HTTP Server API​

When you run wunderland start (or call createWunderlandServer() programmatically), an HTTP server starts on port 3777 (configurable via PORT env var). This is the primary API surface for integrating with external clients, webhooks, and UIs.

Endpoints​

MethodPathDescription
GET/healthServer health check. Returns seedId, agent name, active persona, and available persona count.
POST/chatSend a message and receive a response. Supports JSON (default) and SSE streaming.
GET/api/toolsList all loaded tools with name, description, input schema, category, and side-effect flag.
POST/api/tools/:nameExecute a specific tool directly by name. Body is the tool's input arguments as JSON.
GET/hitlHuman-in-the-loop approval dashboard (HTML).
GET/hitl/pendingList pending HITL approval requests (JSON).
GET/hitl/statsHITL statistics (JSON).
GET/hitl/streamSSE stream for real-time HITL events.
POST/hitl/approvals/:idApprove or reject a pending action.
POST/hitl/checkpoints/:idContinue or abort a checkpoint.
GET/pairingPairing allowlist dashboard (HTML).
GET/pairing/requestsList pending pairing requests.
GET/pairing/allowlistList approved pairings.
POST/pairing/approveApprove a pairing request.
POST/pairing/rejectReject a pairing request.
GET/api/agentos/personasList available personas.
GET/api/agentos/personas/:idGet a specific persona by ID.
POST/api/feedIngest structured content into a channel (e.g., Discord embeds).

Headers​

HeaderPurpose
X-Wunderland-Chat-SecretAuthenticates /chat requests when chatSecret is configured. Also accepted as ?chat_secret= query param.
X-Wunderland-HITL-SecretAuthenticates HITL and pairing endpoints. Also accepted as ?secret= query param.
X-Auto-ApproveAllowed in CORS preflight. Used by clients that manage their own approval flows.
X-API-KeyAuthenticates /api/tools and /api/tools/:name when toolApiSecret is configured.
X-Wunderland-Feed-SecretAuthenticates /api/feed when feedSecret is configured.

POST /chat — Request Body​

{
“message”: “What is the weather in Berlin?”,
“sessionId”: “user-abc-123”,
“personaId”: “friendly-assistant”,
“stream”: true,
“research”: true,
“autoClassify”: true,
“reset”: false,
“toolFailureMode”: “fail_open”,
“tenantId”: “org-456”
}
FieldTypeDefaultDescription
messagestring(required)The user message to process.
sessionIdstring”default”Session identifier for conversation continuity. Max 128 chars.
personaIdstringAgent's defaultPersona to use for this request.
streambooleanfalseEnable SSE streaming mode.
researchboolean | ”quick” | ”moderate” | ”deep”falseInject research-depth instructions. true maps to ”moderate”.
autoClassifybooleantrueAuto-classify research depth via LLM-as-judge when no explicit depth is set.
resetbooleanfalseClear session history before processing this message.
toolFailureModestringConfig default”fail_open” or ”fail_closed” — controls behavior when a tool call fails.
tenantIdstringConfig defaultOrganization/tenant scope for adaptive execution telemetry.

Messages prefixed with /research <query> or /deep <query> also trigger research mode without the body field.

Response Formats​

JSON (default):

{
“reply”: “The weather in Berlin is currently 8°C with overcast skies.”,
“personaId”: “friendly-assistant”
}

SSE (when stream: true):

The response uses Content-Type: text/event-stream. Three event types are emitted:

EventPayloadWhen
progress{ “type”: “SYSTEM_PROGRESS”, “toolName”: “web_search”, “phase”: “executing”, “message”: “Searching...”, “progress”: 0.5 }During tool execution — reports which tool is running and its progress.
reply{ “type”: “REPLY”, “reply”: “The weather is...”, “personaId”: “...” }Final response after all tool rounds complete.
error{ “type”: “ERROR”, “error”: “Provider timeout” }When the turn fails.

Example SSE stream:

event: progress
data: {“type”:”SYSTEM_PROGRESS”,”toolName”:”web_search”,”phase”:”executing”,”message”:”Searching for Berlin weather”,”progress”:null}

event: progress
data: {“type”:”SYSTEM_PROGRESS”,”toolName”:”web_search”,”phase”:”completed”,”message”:”Found 5 results”,”progress”:1}

event: reply
data: {“type”:”REPLY”,”reply”:”The weather in Berlin is currently 8°C with overcast skies.”,”personaId”:”friendly-assistant”}

Quick Example​

# Health check
curl http://localhost:3777/health

# Simple chat
curl -X POST http://localhost:3777/chat \
-H “Content-Type: application/json” \
-d '{“message”: “Hello!”}'

# Streaming chat with research
curl -N -X POST http://localhost:3777/chat \
-H “Content-Type: application/json” \
-d '{“message”: “Compare React and Vue”, “stream”: true, “research”: “deep”}'

# List available tools
curl http://localhost:3777/api/tools

# Execute a tool directly
curl -X POST http://localhost:3777/api/tools/web_search \
-H “Content-Type: application/json” \
-d '{“query”: “AgentOS documentation”}'

Programmatic Server Creation​

import { createWunderlandServer } from 'wunderland/advanced';

const handle = await createWunderlandServer({
port: 4000,
host: '0.0.0.0',
autoApproveToolCalls: true,
llm: { providerId: 'openai', model: 'gpt-4o' },
});

console.log(`Server running at ${handle.url}`);
console.log(`Tools loaded: ${handle.toolCount}`);

// Shut down gracefully
await handle.close();