Workspaces
Your AI organizational headquarters π’
Manage workspaces with clean, intuitive methods. Each workspace is a container for your bots and their memories.
Quick Reference
// Create
const workspace = await client.workspaces.create({ name: 'My Workspace' });
// List all
const workspaces = await client.workspaces.list();
// Get one
const workspace = await client.workspaces.get('workspace_id');
// Update
const updated = await client.workspaces.update('workspace_id', { name: 'New Name' });
// Delete
await client.workspaces.delete('workspace_id');
Create Workspace
Start your empire ποΈ
const workspace = await client.workspaces.create({
name: 'Production Workspace',
description: 'Main production environment' // optional
});
console.log('Created:', workspace.id);
Returns:
{
id: 'ws_123456789',
name: 'Production Workspace',
description: 'Main production environment',
created_at: '2024-01-15T10:30:00Z',
updated_at: '2024-01-15T10:30:00Z'
}
List Workspaces
Show me what you got π
const workspaces = await client.workspaces.list();
workspaces.forEach(ws => {
console.log(`${ws.name} (${ws.bots_count} bots)`);
});
Get Workspace
The full details π
const workspace = await client.workspaces.get('ws_123456789');
console.log(workspace.members); // Team members
console.log(workspace.bots); // All bots in workspace
Update Workspace
Change of plans? βοΈ
const updated = await client.workspaces.update('ws_123456789', {
name: 'Updated Name',
description: 'New description'
});
Delete Workspace
Goodbye, old friend π
await client.workspaces.delete('ws_123456789');
// β οΈ This deletes ALL bots and memories in the workspace!
Common Patterns
Environment Separation
const environments = ['Development', 'Staging', 'Production'];
for (const env of environments) {
await client.workspaces.create({
name: `${env} Environment`,
description: `Workspace for ${env.toLowerCase()}`
});
}
Multi-Tenant Setup
const clients = ['Acme Corp', 'Globex Inc', 'Initech LLC'];
const workspaces = await Promise.all(
clients.map(client =>
client.workspaces.create({
name: `${client} Workspace`,
description: `Dedicated workspace for ${client}`
})
)
);
Error Handling
try {
const workspace = await client.workspaces.create({
name: 'My Workspace'
});
} catch (error) {
if (error.message.includes('already exists')) {
console.log('Workspace name taken!');
} else {
console.error('Something went wrong:', error);
}
}
TypeScript Types
interface WorkspaceData {
id: string;
name: string;
description?: string;
created_at: string;
updated_at: string;
members_count?: number;
bots_count?: number;
}
interface CreateWorkspaceRequest {
name: string;
description?: string;
}
Best Practices
β
Do This
- Use descriptive names
- Add descriptions
- Separate environments
- Clean up unused workspaces
β Avoid This
- Generic names like "Test"
- No organization
- Mixing dev and prod
- Forgetting to delete old ones
Next Steps
Workspace created? Now:
- Create Bots - Populate your workspace
- Store Memories - Make them smart
Keep building! π