
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Official JavaScript/TypeScript SDK for AgentX (https://www.agentx.so/)
The official AgentX JavaScript/TypeScript SDK for AgentX
Why build AI agent with AgentX?
npm install agentx-js
Provide an apiKey
inline or set AGENTX_API_KEY
as an environment variable.
You can get an API key from https://app.agentx.so
import { AgentX } from 'agentx-js';
const client = new AgentX(apiKey: "<your api key here>");
// Get the list of agents you have
const agents = await client.listAgents();
console.log(agents);
Each Conversation has agents
and users
tied to it.
// get agent
const myAgent = await client.getAgent(id: "<agent id here>");
// Get the list of conversation from this agent
const existingConversations = await myAgent.listConversations();
console.log(existingConversations);
// Get the list of history messages from a conversation
const lastConversation = existingConversations[existingConversations.length - 1];
const msgs = await lastConversation.listMessages();
console.log(msgs);
A chat
needs to happen in the conversation. You can do stream
response too, default false
.
const aConversation = await myAgent.getConversation(id: "<conversation id here>");
// Regular chat
const response = await aConversation.chat("Hello, what is your name?");
// Streaming chat
const stream = aConversation.chatStream("Hello, what is your name?");
for await (const chunk of stream) {
console.log(chunk);
}
output looks like:
{ text: null, cot: 'The user is greeting and asking for my ', botId: 'xxx' }
{ text: null, cot: 'name, which are casual, straightforward questions.', botId: 'xxx' }
{ text: null, cot: ' I can answer these directly', botId: 'xxx' }
{ text: 'Hello', cot: null, botId: 'xxx' }
{ text: '!', cot: null, botId: 'xxx' }
{ text: ' I', cot: null, botId: 'xxx' }
{ text: ' am', cot: null, botId: 'xxx' }
{ text: ' AgentX', cot: null, botId: 'xxx' }
{ text: null, cot: null, botId: 'xxx' }
*cot
stands for chain-of-thoughts
A Workforce (team) consists of multiple agents working together with a designated manager agent.
import { AgentX } from 'agentx-js';
const client = new AgentX(apiKey: "<your api key here>");
// Get the list of workforces/teams you have
const workforces = await AgentX.listWorkforces();
console.log(workforces);
// Get a specific workforce
const workforce = workforces[0]; // or any specific workforce
console.log(`Workforce: ${workforce.name}`);
console.log(`Manager: ${workforce.manager.name}`);
console.log(`Agents: ${workforce.agents.map(agent => agent.name)}`);
// Create a new conversation with the workforce
const conversation = await workforce.newConversation();
// List all existing conversations for the workforce
const conversations = await workforce.listConversations();
console.log(conversations);
Chat with the entire workforce team and get streaming responses from all agents.
// Stream chat with the workforce
const stream = workforce.chatStream(
conversation.id,
"How can you help me with this project?"
);
for await (const chunk of stream) {
if (chunk.text) {
process.stdout.write(chunk.text);
}
if (chunk.cot) {
console.log(` [COT: ${chunk.cot}]`);
}
}
The workforce chat allows you to leverage multiple specialized agents working together to provide comprehensive responses to your queries.
This SDK is written in TypeScript and provides full type definitions. All classes, interfaces, and methods are properly typed for better development experience.
The main client class for interacting with the AgentX API.
new AgentX(apiKey?: string)
- Creates a new AgentX client instancegetAgent(id: string): Promise<Agent>
- Get a specific agent by IDlistAgents(): Promise<Agent[]>
- List all agentsgetProfile(): Promise<any>
- Get the current user's profilestatic listWorkforces(): Promise<Workforce[]>
- List all workforcesRepresents an individual AI agent.
id: string
- Agent IDname: string
- Agent nameavatar?: string
- Agent avatar URLcreatedAt?: string
- Creation timestampupdatedAt?: string
- Last update timestampgetConversation(id: string): Promise<Conversation>
- Get a specific conversationlistConversations(): Promise<Conversation[]>
- List all conversationsRepresents a conversation between users and agents.
id: string
- Conversation IDtitle?: string
- Conversation titleusers: string[]
- User IDs in the conversationagents: string[]
- Agent IDs in the conversationcreatedAt?: string
- Creation timestampupdatedAt?: string
- Last update timestampnewConversation(): Promise<Conversation>
- Create a new conversationlistMessages(): Promise<Message[]>
- List all messages in the conversationchat(message: string, context?: number): Promise<any>
- Send a messagechatStream(message: string, context?: number): AsyncGenerator<ChatResponse>
- Stream chat responsesRepresents a team of agents working together.
id: string
- Workforce IDname: string
- Workforce nameagents: Agent[]
- List of agents in the workforcemanager: Agent
- Manager agentdescription: string
- Workforce descriptionimage: string
- Workforce image URLnewConversation(): Promise<Conversation>
- Create a new workforce conversationlistConversations(): Promise<Conversation[]>
- List all workforce conversationschatStream(conversationId: string, message: string, context?: number): AsyncGenerator<ChatResponse>
- Stream chat with workforceThe SDK throws descriptive errors for various failure scenarios:
try {
const agent = await client.getAgent("invalid-id");
} catch (error) {
console.error("Error:", error.message);
}
AGENTX_API_KEY
- Your AgentX API key (optional if passed to constructor)MIT License
FAQs
Official JavaScript/TypeScript SDK for AgentX (https://www.agentx.so/)
The npm package agentx-js receives a total of 0 weekly downloads. As such, agentx-js popularity was classified as not popular.
We found that agentx-js 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
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.