Your AI agents with memory 🤖
A Bot is an individual AI agent within a workspace. Each bot has its own isolated memory.
bot = client.bots.create({
'name': 'Support Agent',
'workspace_id': 'ws_abc123',
'description': 'Handles customer support queries'
})
print(f"Bot ID: {bot['id']}")# All bots
bots = client.bots.list()
# Filter by workspace
workspace_bots = [b for b in bots if b['workspace_id'] == 'ws_abc123']bot = client.bots.get('bot_xyz789')
print(bot['name'])updated = client.bots.update({
'id': 'bot_xyz789',
'name': 'New Name',
'description': 'Updated description'
})client.bots.delete('bot_xyz789')Warning: Deleting a bot deletes all its memories!
# ✅ Good - Clear roles
support_bot = client.bots.create({
'name': 'Customer Support',
'workspace_id': workspace_id
})
sales_bot = client.bots.create({
'name': 'Sales Assistant',
'workspace_id': workspace_id
})
# ❌ Bad - Vague purpose
generic_bot = client.bots.create({
'name': 'Bot',
'workspace_id': workspace_id
})def get_user_bot(user_id: str, workspace_id: str):
"""One bot per user"""
bots = client.bots.list()
user_bot = next(
(b for b in bots
if b['name'] == f'user_{user_id}'
and b['workspace_id'] == workspace_id),
None
)
if not user_bot:
user_bot = client.bots.create({
'name': f'user_{user_id}',
'workspace_id': workspace_id,
'description': f'Personal bot for user {user_id}'
})
return user_bot# One bot for company-wide knowledge
knowledge_bot = client.bots.create({
'name': 'Company Knowledge Base',
'workspace_id': workspace_id,
'description': 'Shared knowledge for all agents'
})
# All users search this bot
def search_knowledge(query: str):
return client.memories.search({
'bot_id': knowledge_bot['id'],
'query': query
})# Temporary bot for a conversation
session_bot = client.bots.create({
'name': f'session_{session_id}',
'workspace_id': workspace_id,
'description': 'Temporary conversation context'
})
# Clean up later
def cleanup_old_sessions():
bots = client.bots.list()
for bot in bots:
if bot['name'].startswith('session_'):
# Delete if old
client.bots.delete(bot['id'])Next: Memories →