# Clone the repository
git clone <your-repo>
cd liz
# Install dependencies
pnpm install
Create a .env file in your project root with the following variables:
# Database configuration (choose one)
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
# Or for SQLite:
DATABASE_URL="file:./prisma/dev.db"
# LLM API Keys
OPENAI_API_KEY="your-openai-api-key"
OPENROUTER_API_KEY="your-openrouter-api-key"
# Application URL (required for OpenRouter)
APP_URL="http://localhost:3000"
# Initialize the database
npm run init-db
Create a new file src/agents/assistant.ts:
import { Character } from "../types";
import { BaseAgent } from "../agent";
const assistantCharacter: Character = {
name: "Assistant",
agentId: "assistant_1",
system: "You are a helpful assistant.",
bio: ["A knowledgeable AI assistant"],
lore: ["Created to help users with various tasks"],
messageExamples: [
[
{ user: "user1", content: { text: "Hello!" } },
{ user: "Assistant", content: { text: "Hi! How can I help?" } }
]
],
postExamples: [],
topics: ["general help", "task assistance"],
style: {
all: ["helpful", "friendly"],
chat: ["conversational"],
post: ["clear", "concise"]
},
adjectives: ["helpful", "knowledgeable"],
routes: []
};
export const assistant = new BaseAgent(assistantCharacter);
Create src/server.ts to handle agent interactions:
import express from "express";
import { AgentFramework } from "./framework";
import { standardMiddleware } from "./middleware";
import { assistant } from "./agents/assistant";
import { InputSource, InputType } from "./types";
const app = express();
app.use(express.json());
const framework = new AgentFramework();
standardMiddleware.forEach((middleware) => framework.use(middleware));
app.post("/agent/input", (req, res) => {
const input = {
source: InputSource.NETWORK,
userId: req.body.userId,
agentId: assistant.getAgentId(),
roomId: `room_${req.body.userId}`,
type: InputType.TEXT,
text: req.body.text
};
framework.process(input, assistant, res);
});
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
});
# Start the development server
npm run dev
Send a test request to your agent:
curl -X POST http://localhost:3000/agent/input \
-H "Content-Type: application/json" \
-d '{
"userId": "test_user",
"text": "Hello, assistant!"
}'