packages/examples/react/README.md
A React implementation of the classic ELIZA chatbot powered by elizaOS, featuring a beautiful retro CRT terminal interface.
This example demonstrates:
# From the repository root, install all dependencies
bun install
# Navigate to this example
cd examples/react
# Start development server
bun dev
The app will open at http://localhost:5173
This example uses the full elizaOS agent framework:
┌─────────────────────────────────────────────────────────────┐
│ React Application │
│ (App.tsx) │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ eliza-runtime.ts │
│ (AgentRuntime singleton manager) │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ AgentRuntime │
│ (@elizaos/core) │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
▼ ▼
┌──────────────────────────┐ ┌──────────────────────────┐
│ plugin-sql │ │ plugin-eliza-classic │
│ (PGLite adapter) │ │ (Pattern matching) │
│ │ │ │
│ In-browser PostgreSQL │ │ TEXT_LARGE handler │
│ with persistent storage │ │ TEXT_SMALL handler │
└──────────────────────────┘ └──────────────────────────┘
This implementation uses the original ELIZA pattern matching algorithm from Joseph Weizenbaum's 1966 program:
The classic ELIZA logic is wrapped as an elizaOS plugin that provides model handlers:
export const elizaClassicPlugin: Plugin = {
name: "eliza-classic",
description: "Classic ELIZA pattern matching psychotherapist",
priority: 100, // High priority to override other model providers
models: {
[ModelType.TEXT_LARGE]: handleTextGeneration,
[ModelType.TEXT_SMALL]: handleTextSmall,
},
};
When the runtime processes a user message via runtime.messageService.handleMessage(...), it will ultimately route to the classic ELIZA model handlers (TEXT_LARGE/TEXT_SMALL) provided by plugin-eliza-classic instead of an LLM API.
Unlike modern chatbots, classic ELIZA uses purely rule-based pattern matching. This makes it:
examples/react/
├── src/
│ ├── main.tsx # React entry point
│ ├── App.tsx # Main chat component
│ ├── App.css # Terminal styling
│ ├── index.css # Global styles
│ ├── eliza-runtime.ts # AgentRuntime singleton manager
│ └── plugin-eliza-classic.ts # ELIZA pattern matching plugin
├── index.html
├── package.json
├── tsconfig.json
└── vite.config.ts
The UI features:
bun run build
Output will be in the dist/ directory.
You can add additional model providers by creating new plugins. The AgentRuntime will select handlers based on priority:
// Example: Add an LLM fallback with lower priority
const llmPlugin: Plugin = {
name: "llm-fallback",
priority: 50, // Lower than ELIZA's 100
models: {
[ModelType.TEXT_LARGE]: async (runtime, params) => {
// Call your LLM API here
},
},
};
The bootstrap plugin (actions, providers, services) is now automatically included in the elizaOS core runtime. No need to manually import or configure it - it's built-in and auto-registered during initialization.
ELIZA was created by Joseph Weizenbaum at MIT in 1966. It simulates a Rogerian psychotherapist by:
This "ELIZA effect" - where people attribute human-like understanding to simple pattern matching - remains relevant in discussions about AI today.
MIT