Quickstart

Build your first ClawLayer-enhanced OpenClaw agent in minutes!

Prerequisites

  • ClawLayer SDK installed (see Installation)

  • OpenClaw installed

  • API keys configured in .env

Step 1: Create Your First Enhanced Agent

Let's create a simple agent and enhance it with ClawLayer's personality and memory features.

Basic Setup

Create a new file agent.ts:

import { ClawLayer } from '@clawlayer/sdk';
import { OpenClaw } from 'openclaw';

// Initialize your OpenClaw agent
const baseAgent = new OpenClaw({
  model: 'claude-3-sonnet',
  apiKey: process.env.ANTHROPIC_API_KEY
});

// Enhance it with ClawLayer
const enhancedAgent = new ClawLayer(baseAgent, {
  personality: {
    name: 'Alex',
    traits: ['helpful', 'friendly', 'professional'],
    voice: 'casual yet knowledgeable',
    emotionalRange: 'moderate'
  },
  memory: {
    enabled: true,
    provider: 'pinecone',
    apiKey: process.env.PINECONE_API_KEY
  },
  cache: {
    enabled: true,
    ttl: 3600 // 1 hour cache
  }
});

// Start chatting
async function main() {
  const response = await enhancedAgent.chat({
    userId: 'user-123',
    message: 'Hello! What can you help me with?'
  });

  console.log('Agent:', response.text);
}

main();

Run Your Agent

Expected output:

Step 2: Test Memory Persistence

Let's verify that the agent remembers past conversations:

Step 3: Configure Advanced Features

Enable Analytics

Track conversation quality and performance:

Add Custom Plugins

Extend your agent with custom capabilities:

Step 4: Multi-User Support

Handle multiple users with isolated memory:

Complete Example: Customer Support Agent

Here's a full example combining all features:

Configuration Options

Personality Configuration

Memory Configuration

Cache Configuration

Analytics Configuration

Next Steps

Now that you've built your first enhanced agent, explore:

Common Patterns

Pattern 1: Personal Assistant

Pattern 2: AI Influencer

Pattern 3: Research Assistant

Troubleshooting

Agent doesn't remember past conversations

Check that memory is properly configured:

Slow response times

Enable caching to improve performance:

Personality seems inconsistent

Increase the personality strength and provide more specific traits:

Need Help?

Last updated