Skip to main content

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:

Terminal
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/node
Note

reflect-metadata is required — The decorators rely on metadata reflection. You must import it once at the top of your entry file: import "reflect-metadata";

Tip

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:

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"]
}
Warning

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

  1. Go to app.daemo.ai
  2. Sign up or log in
  3. Create a new Organization (or use an existing one)

4b. Create a New Agent

  1. Inside your organization, click Create New Agent
  2. 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
Note

Storage configuration is permanent and cannot be changed after creation. Choose wisely!

  1. Click Create

4c. Copy Your API Key

After creating the agent:

  1. You'll see your DAEMO_AGENT_API_KEY
  2. Copy it immediately — it's only shown once!
  3. Store it securely (password manager, secure notes, etc.)
Warning

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:

.env
DAEMO_AGENT_API_KEY=your-api-key-here

Add .env to your .gitignore:

Terminal
echo ".env" >> .gitignore
Tip

Install dotenv to load environment variables automatically:

Terminal
npm install dotenv

Then add this at the top of your entry file:

src/index.ts
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:

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:

Terminal
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:

Terminal
npm install daemo-engine

"Experimental decorators" error

Add these to your tsconfig.json:

tsconfig.json
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}

"API Key not found"

  1. Check your .env file exists and has the key
  2. Make sure you're loading dotenv: import 'dotenv/config';
  3. Verify the variable name matches exactly: DAEMO_AGENT_API_KEY

Next Steps

Your project is set up! Now let's create some functions: