
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
daemon-agent
Advanced tools
A framework for building and running background agents with tool-use capabilities
A framework for building and running background agents with tool-use capabilities.
Daemon Agent provides a flexible, type-safe framework for creating autonomous agents powered by OpenAI's language models. The framework includes support for:
npm install daemon-agent
The following peer dependencies are required:
@qdrant/js-client-rest: ^1.14.0 (for vector storage)openai: ^4.0.0zod: ^3.0.0typescript: ^5import { OpenAI } from 'openai';
import { QdrantClient } from '@qdrant/js-client-rest';
import {
OpenAIAgent,
OpenAIEmbedding,
OpenAIChatLLM,
QdrantMemory,
ReasoningTool,
SendMessageTool
} from 'daemon-agent';
// Initialize OpenAI client
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY
});
// Set up embedding and LLM
const embedding = new OpenAIEmbedding({ client });
const llm = new OpenAIChatLLM({ client });
// Initialize Qdrant for vector storage
const qdrantClient = new QdrantClient({
url: process.env.QDRANT_URL
});
// Create memory with persistence
const memory = new QdrantMemory({
id: 'my-agent',
collectionName: 'agent-memories',
qdrantClient,
embedding,
llm
});
// Create tools
const sendMessageTool = new SendMessageTool();
// Create an agent
const agent = new OpenAIAgent({
name: 'my-agent',
client,
model: 'gpt-4-turbo',
memory,
tools: [sendMessageTool]
});
// Listen for events
agent.event.on('finalMessage', (message) => {
console.log('Agent response:', message.content);
});
// Run the agent with initial message
const result = await agent.run({
messages: [{
role: 'user',
content: 'Hello, I need help with my project.'
}]
});
// Print the final response messages
console.log(result);
The framework follows a modular architecture with several key components:
BaseAgent: Abstract interface for all agent implementationsOpenAIAgent: Implementation using OpenAI's chat completions APIOpenAIAgentOS: Extended agent with operating-system like capabilitiesBaseAgentMemory: Abstract memory interfaceInMemoryMemory: Simple in-memory storageQdrantMemory: Vector-based persistent storage using QdrantBaseEmbedding: Abstract embedding interfaceOpenAIEmbedding: Implementation using OpenAI's embedding modelsBaseLLM: Abstract LLM interfaceOpenAIChatLLM: Implementation using OpenAI's chat modelsOpenAITool: Base class for creating tools with Zod schemasReasoningTool: Allows the agent to reason step-by-stepSendMessageTool: Enables messaging functionalitySleepTool: Allows the agent to pause executionLinkupSearchTool: Provides search capabilitiesimport { z } from 'zod';
import { OpenAITool } from 'daemon-agent';
new OpenAITool({
name: "calculator",
description: "Perform basic mathematical operations",
parameters: z.object({
operation: z.enum(["add", "subtract", "multiply", "divide"]),
a: z.number(),
b: z.number(),
}),
function: async (params) => {
// complete typesafety
const { operation, a, b } = params;
switch (operation) {
case "add":
return String(a + b);
case "subtract":
return String(a - b);
case "multiply":
return String(a * b);
case "divide":
return String(a / b);
}
},
}),
agent.event.on('stepMessage', ({ step, message }) => {
console.log(`Step ${step}:`, message);
});
agent.event.on('usage', ({ step, usage }) => {
console.log(`Token usage at step ${step}:`, usage);
});
agent.event.on('totalUsage', (usage) => {
console.log('Total token usage:', usage);
});
MIT
Viky (vikyw89@gmail.com)
FAQs
A framework for building and running background agents with tool-use capabilities
The npm package daemon-agent receives a total of 4 weekly downloads. As such, daemon-agent popularity was classified as not popular.
We found that daemon-agent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.