Tutorial 0: Bootstrap Your First Project
Get started with VibeX in under 5 minutes.
This tutorial walks you through setting up a complete VibeX project from scratch.
Quick Start
The fastest way to get started is to clone the quick-start example:
# Clone the VibeX repository
git clone https://github.com/tiwater/vibex.git
cd vibex/examples/quick-start
# Install dependencies
pnpm install
# Set up your environment
cp env.example .env
# Edit .env with your API key
# Run the example
pnpm startManual Setup
If you prefer to set up a project from scratch:
1. Create a New Project
mkdir my-vibex-project
cd my-vibex-project
pnpm init2. Install Dependencies
# Install VibeX and dotenv for environment variables
pnpm add vibex dotenv
# Install TypeScript development dependencies
pnpm add -D typescript tsx @types/node3. Configure TypeScript
Create tsconfig.json:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"outDir": "dist"
},
"include": ["src/**/*"]
}4. Set Up Environment Variables
Create a .env file with your API key:
# Choose your LLM provider
# OpenAI
OPENAI_API_KEY=sk-your-openai-key
# Or Anthropic
ANTHROPIC_API_KEY=your-anthropic-key
# Or DeepSeek
DEEPSEEK_API_KEY=your-deepseek-key5. Create Your First Script
Create src/index.ts:
import "dotenv/config";
import { XAgent } from "vibex";
async function main() {
console.log("🚀 Starting VibeX...\n");
// Create a new workspace
const xAgent = await XAgent.start("My first VibeX project");
const space = xAgent.getSpace();
console.log(`✨ Created Space: ${space.spaceId}`);
console.log(`📋 Goal: ${space.goal}\n`);
// Chat with XAgent
console.log("🤖 XAgent: ");
const stream = await xAgent.streamText({
messages: [
{ role: "user", content: "Hello! What can you help me with?" }
],
metadata: { mode: "agent", requestedAgent: "X" },
});
for await (const chunk of stream.textStream) {
process.stdout.write(chunk);
}
console.log("\n");
// Save the workspace
await space.persistState();
console.log(`💾 Workspace saved! Space ID: ${space.spaceId}`);
}
main().catch(console.error);6. Add Scripts to package.json
Update your package.json:
{
"name": "my-vibex-project",
"type": "module",
"scripts": {
"start": "tsx src/index.ts",
"dev": "tsx watch src/index.ts"
}
}7. Run Your Project
pnpm startYou should see:
🚀 Starting VibeX...
✨ Created Space: space_abc123xyz
📋 Goal: My first VibeX project
🤖 XAgent: Hello! I'm XAgent, your AI assistant...
💾 Workspace saved! Space ID: space_abc123xyzProject Structure
Your complete project should look like this:
my-vibex-project/
├── src/
│ └── index.ts # Your main application
├── .env # API keys (don't commit this!)
├── .gitignore # Git ignore file
├── package.json # Project configuration
└── tsconfig.json # TypeScript configurationCreate a .gitignore file:
node_modules/
dist/
.env
*.logLLM Provider Options
VibeX supports multiple LLM providers. Configure your preferred provider in .env:
| Provider | Environment Variable | Models |
|---|---|---|
| OpenAI | OPENAI_API_KEY | gpt-4o, gpt-4o-mini, gpt-4-turbo |
| Anthropic | ANTHROPIC_API_KEY | claude-3-5-sonnet, claude-3-opus |
| DeepSeek | DEEPSEEK_API_KEY | deepseek-chat, deepseek-coder |
GOOGLE_GENERATIVE_AI_API_KEY | gemini-1.5-pro, gemini-1.5-flash |
Troubleshooting
“API key not found” error?
- Make sure your
.envfile exists and contains the correct key - Ensure
dotenv/configis imported at the top of your file - Check that the environment variable name matches your provider
TypeScript errors?
- Run
pnpm add -D @types/nodeif you’re missing Node.js types - Make sure your
tsconfig.jsonhas"moduleResolution": "bundler"
“Cannot find module ‘vibex’” error?
- Run
pnpm installto ensure dependencies are installed - Check that
vibexis listed in yourpackage.jsondependencies
Next Steps
Now that you have a working project:
- Experiment: Try different prompts and see how XAgent responds
- Learn: Continue to Tutorial 1: Your First Agent
- Explore: Check out the example projects
Ready to dive deeper? Continue to Tutorial 1: Your First Agent! 🚀