Bots

Your AI workforce awaits πŸ€–

Create and manage AI agents with their own memory stores. Each bot is an independent entity ready to remember and recall.

Quick Reference

// Create
const bot = await client.bots.create({
  name: 'My Bot',
  workspaceId: 'ws_123'
});

// List
const bots = await client.bots.list({ workspaceId: 'ws_123' });

// Get
const bot = await client.bots.get('bot_id');

// Update
const updated = await client.bots.update('bot_id', { name: 'New Name' });

// Delete
await client.bots.delete('bot_id');

Create Bot

Give it life! ⚑

const bot = await client.bots.create({
  name: 'Customer Support Bot',
  workspaceId: 'ws_123456789',
  description: 'Handles customer inquiries', // optional
  metadata: {                                 // optional
    model: 'gpt-4',
    temperature: 0.7,
    department: 'support'
  }
});

console.log('Bot ID:', bot.id);

List Bots

Assemble the team πŸ“‹

// All bots in a workspace
const bots = await client.bots.list({
  workspaceId: 'ws_123456789'
});

// With pagination
const bots = await client.bots.list({
  workspaceId: 'ws_123456789',
  page: 1,
  perPage: 20
});

bots.bots.forEach(bot => {
  console.log(`${bot.name}: ${bot.memories_count} memories`);
});

Get Bot

The full profile πŸ‘€

const bot = await client.bots.get('bot_987654321');

console.log(bot.name);
console.log(bot.memories_count);
console.log(bot.metadata);
console.log(bot.workspace); // Full workspace info

Update Bot

Evolution time πŸ¦‹

const updated = await client.bots.update('bot_987654321', {
  name: 'Support Bot Pro',
  description: 'Now with 50% more helpfulness',
  metadata: {
    version: '2.0',
    capabilities: ['chat', 'search', 'analyze']
  }
});

Delete Bot

Retirement πŸšͺ

await client.bots.delete('bot_987654321');
// ⚠️ Deletes the bot AND all its memories!

Common Patterns

Create Multiple Bots

const botNames = [
  'Support Bot 1',
  'Support Bot 2',
  'Support Bot 3'
];

const bots = await Promise.all(
  botNames.map(name =>
    client.bots.create({
      name,
      workspaceId: 'ws_123',
      metadata: { team: 'support' }
    })
  )
);

Organize by Function

const functions = [
  { name: 'Tech Support Bot', role: 'support' },
  { name: 'Sales Bot', role: 'sales' },
  { name: 'Analytics Bot', role: 'analytics' }
];

for (const func of functions) {
  await client.bots.create({
    name: func.name,
    workspaceId: 'ws_123',
    metadata: {
      role: func.role,
      department: func.role,
      created_at: new Date().toISOString()
    }
  });
}

Bot with Rich Metadata

const bot = await client.bots.create({
  name: 'Enterprise Assistant',
  workspaceId: 'ws_123',
  metadata: {
    version: '1.0',
    model: 'gpt-4',
    temperature: 0.7,
    max_tokens: 4096,
    capabilities: ['chat', 'search', 'analysis'],
    department: 'enterprise',
    tier: 'premium',
    features: {
      multilingual: true,
      sentiment_analysis: true,
      context_aware: true
    }
  }
});

Error Handling

try {
  const bot = await client.bots.create({
    name: 'My Bot',
    workspaceId: 'ws_invalid'
  });
} catch (error) {
  if (error.message.includes('Workspace not found')) {
    console.log('Invalid workspace ID!');
  } else if (error.message.includes('already exists')) {
    console.log('Bot name already taken in this workspace!');
  }
}

TypeScript Types

interface BotData {
  id: string;
  name: string;
  workspace_id: string;
  description?: string;
  metadata?: Record<string, any>;
  memories_count?: number;
  created_at: string;
  updated_at: string;
}

interface CreateBotRequest {
  name: string;
  workspaceId: string;
  description?: string;
  metadata?: Record<string, any>;
}

Best Practices

βœ… Do This

  • Clear, descriptive names
  • Use metadata for configuration
  • Track versions in metadata
  • One purpose per bot

❌ Avoid This

  • Generic names like "Bot1"
  • Overloading one bot
  • No metadata
  • Forgetting to clean up

Next Steps

Bot created? Time to:

  1. Store Memories - Give it a brain
  2. Framework Examples - See real implementations

Build your bot army! πŸ€–βš‘