How It Works
Understand the architecture before you build. This page explains what happens when you connect your code to Daemo.
The Three Componentsβ
Every Daemo project has three parts:
Your Code
TypeScript/JavaScript functions running in your environment (local machine, server, cloud function, etc.)
- You write the business logic
- Functions stay in your repo
- Your data never leaves your control
Daemo SDK
The daemo-engine package that connects your functions to the Daemo Engine.
- Registers function metadata
- Establishes secure connection
- Handles function invocation
Daemo Platform
The app.daemo.ai dashboard and AI engine.
- Agent management
- AI reasoning (Two-Phase Engine)
- Playground for testing
The Connection Flowβ
When you run your Daemo service, here's what happens:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β YOUR ENVIRONMENT β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Your Code (index.ts) β β
β β ββββββββββββββββββββ ββββββββββββββββββββ β β
β β β CalculatorFuncs β β CRMFunctions β β Your functions β β
β β β - power() β β - getContacts() β β β
β β β - add() β β - createDeal() β β β
β β ββββββββββββββββββββ ββββββββββββββββββββ β β
β β β β β β
β β βΌ βΌ β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β DaemoBuilder + registerService() β β β
β β β Extracts: function names, descriptions, I/O types β β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β β gRPC (secure tunnel) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DAEMO PLATFORM β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Daemo Engine β β
β β ββββββββββββββββββββ ββββββββββββββββββββ β β
β β β Function Registryβ β Two-Phase Engine β β β
β β β β’ Metadata β β β’ Query Analysis β β β
β β β β’ Types ββββ€ β’ Tool Selection β β β
β β β β’ Descriptions β β β’ Execution β β β
β β ββββββββββββββββββββ ββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β app.daemo.ai Dashboard β β
β β β’ View registered services & functions β β
β β β’ Test in Playground β β
β β β’ View logs & analytics β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
What Gets Sent to Daemo?β
When your service starts, the SDK sends metadata only β not your code:
| Sent to Daemo | NOT Sent |
|---|---|
| Function names | Your source code |
| Descriptions (from decorators) | Your business logic |
| Input/output type definitions | Your data |
| Service name | Your environment variables |
Your code runs locally. When AI needs to call a function, Daemo sends a request to your running service. The function executes in your environment and returns the result.
The Runtime Flowβ
When a user asks a question in the Playground (or via API):
power() function based on description{a: 2, b: 10}{result: 1024}Key Conceptsβ
Servicesβ
A service is a collection of related functions. You might have:
CRMServicewith contact and deal functionsAnalyticsServicewith reporting functionsNotificationServicewith email/SMS functions
Each service has its own system prompt that guides the AI on how to use its functions.
Tools (Functions)β
Tools are individual functions decorated with Daemo metadata. The decorators tell the AI:
- What the function does (
@Description) - What inputs it expects (
@Input) - What it returns (
@Output)
Agentsβ
An agent on app.daemo.ai can have multiple services connected. Think of it as the "brain" that orchestrates all your functions.
Why This Architecture?β
Your code and data stay in your environment
Run anywhere β laptop, server, Lambda, etc.
Change functions, restart service, instantly updated
Dashboard shows all registered functions in real-time
Next Stepsβ
Now that you understand the architecture:
- Installation β Set up your project
- Defining Tools β Learn the decorator syntax