
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.
Ajent is a JavaScript library for building conversational agents with tool capabilities. It provides a framework to create, manage, and orchestrate multiple agents that can handle different types of conversations and tasks.
npm install ajent
# or
yarn add ajent
import { Agent } from 'ajent';
import { Tool } from '../../tooling/tool.js';
class MyCustomAgent extends Agent {
constructor() {
super("my_agent", "Handle specific tasks");
this.addTool(new Tool('myTool1', "Description of tool 1", this.myTool1));
}
instruction = () => {
return "Your custom instructions here";
}
myTool1(param1) {
// Tool implementation
return "Result";
}
}
import { Squad } from 'ajent';
import { MyCustomAgent } from './myCustomAgent';
const agents = [new MyCustomAgent()];
const squad = new Squad({
agents,
apiToken: 'your-api-token'
});
// Send a message
const response = await squad.send("Your message here");
To initialize the Squad, you need to provide an authentication token. You can obtain the token by registering an endpoint on the www.ajent.com.br website, where you will receive an apiToken for secure usage.
If you need a quicker solution for testing, you can directly use the LLM token (llmToken), as shown below:
const squad = new Squad({
agents,
llmToken: 'your-llm-token'
});
Warning: Using the llmToken directly on the client side is not secure and should never be done in production, as it exposes the token publicly. For production environments, we strongly recommend creating a secure endpoint on www.ajent.com.br.
Alternatively, you can build your own proxy service to interact with the LLM. To facilitate this implementation, we provide an open-source library at: https://github.com/gugaio/ajent-py-server-lib.
import React, { useState } from 'react';
import { Squad } from 'ajent';
import { MyCustomAgent } from './myCustomAgent';
function ChatComponent() {
const [messages, setMessages] = useState([]);
const [squad] = useState(() => {
const agents = [new MyCustomAgent()];
return new Squad({
agents,
apiToken: process.env.REACT_APP_API_TOKEN
});
});
const handleSendMessage = async (message) => {
try {
const response = await squad.send(message);
setMessages(prev => [...prev,
{ role: 'user', content: message },
{ role: 'assistant', content: response }
]);
} catch (error) {
console.error('Error:', error);
}
};
return (
<div>
{messages.map((msg, index) => (
<div key={index}>
<strong>{msg.role}:</strong> {msg.content}
</div>
))}
<input
type="text"
onKeyPress={e => {
if (e.key === 'Enter') {
handleSendMessage(e.target.value);
e.target.value = '';
}
}}
/>
</div>
);
}
export default ChatComponent;
TriageAgent: Routes conversations to appropriate specialist agentsPlaybackAgent: Handles video playback analysis and informationCustomerServiceAgent: Handles customer service inquiries (example implementation)Agent class@tool decoratorinstructions() methodExample:
import { Agent, tool } from 'ajent';
class CustomAgent extends Agent {
constructor() {
super("custom_agent", "Handle custom tasks");
}
instructions = () => ({
instruction: "Custom instructions",
tools: [this.customTool]
});
@tool("Custom tool description")
customTool(param) {
return `Processed ${param}`;
}
}
new Squad({
agents, // Array of agents
apiToken, // API token for authentication
triageInstruction // Optional triage instructions
})
class Agent {
constructor(id, task)
instructions()
toolSchemas(tools)
mapTools()
}
@tool(description)
Security:
Performance:
Error Handling:
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the ISC License - see the LICENSE file for details.
FAQs
- [Read in English](README.md)
We found that ajent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.