Installation & Setup
Get your project ready and connect to Daemo in about 2 minutes.
Prerequisites
Before you begin, make sure you have:
- Node.js v18+ (check with
node -v) - npm or yarn
- A Daemo account (free to create)
Step 1: Create Your Project
If you're starting fresh:
mkdir my-daemo-agent
cd my-daemo-agent
npm init -y
Step 2: Install Dependencies
Install the Daemo SDK, TypeScript, and required peer dependencies:
npm install daemo-engine reflect-metadata
npm install -D typescript ts-node @types/nodereflect-metadata is required — The decorators rely on metadata reflection. You must import it once at the top of your entry file: import "reflect-metadata";
SDK Info: The daemo-engine package is available on npm and libraries.io. Current version: 0.2.4
Step 3: Configure TypeScript
Create a tsconfig.json:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"rootDir": "./src",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Important: You must enable experimentalDecorators and emitDecoratorMetadata for the Daemo decorators to work.
Step 4: Get Your API Key
This is where you connect to the Daemo platform:
4a. Create an Organization
- Go to app.daemo.ai
- Sign up or log in
- Create a new Organization (or use an existing one)
4b. Create a New Agent
- Inside your organization, click Create New Agent
- Fill in the details:
- Agent Name: Give it a descriptive name (e.g., "My CRM Agent")
- Description: (optional) What this agent does
- Storage Configuration: Choose one:
- Daemo Storage (Managed) — No setup required, Daemo handles it
- Custom MongoDB — Bring your own database
Storage configuration is permanent and cannot be changed after creation. Choose wisely!
- Click Create
4c. Copy Your API Key
After creating the agent:
- You'll see your
DAEMO_AGENT_API_KEY - Copy it immediately — it's only shown once!
- Store it securely (password manager, secure notes, etc.)
Save this key! If you lose it, you'll need to regenerate a new one from the dashboard.
Step 5: Set Up Your Environment
Create a .env file in your project root:
DAEMO_AGENT_API_KEY=your-api-key-here
Add .env to your .gitignore:
echo ".env" >> .gitignore
Install dotenv to load environment variables automatically:
npm install dotenv
Then add this at the top of your entry file:
import 'dotenv/config';
Project Structure
Here's a recommended folder structure:
my-daemo-agent/
├── src/
│ ├── index.ts # Entry point
│ ├── services/ # Your tool functions
│ │ ├── calculator.ts
│ │ └── crm.ts
│ └── types/ # Shared types (optional)
├── .env # Your API key (gitignored)
├── .gitignore
├── package.json
└── tsconfig.json
Verify Installation
Create a quick test file src/index.ts:
import 'dotenv/config';
import "reflect-metadata";
import { DaemoBuilder } from 'daemo-engine';
console.log("Daemo SDK loaded successfully!");
console.log("API Key configured:", !!process.env.DAEMO_AGENT_API_KEY);
Run it:
npx ts-node src/index.ts
You should see:
Daemo SDK loaded successfully!
API Key configured: true
Troubleshooting
"Cannot find module 'daemo-engine'"
Make sure you installed the package:
npm install daemo-engine
"Experimental decorators" error
Add these to your tsconfig.json:
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
"API Key not found"
- Check your
.envfile exists and has the key - Make sure you're loading dotenv:
import 'dotenv/config'; - Verify the variable name matches exactly:
DAEMO_AGENT_API_KEY
Next Steps
Your project is set up! Now let's create some functions:
- Defining Tools — Create functions with decorators