{"_id":"@agentx-ai/agentx-js","_rev":"5-224112b63d7ee62f9dc7d4df3178ac11","name":"@agentx-ai/agentx-js","dist-tags":{"latest":"0.4.3"},"versions":{"0.4.0":{"name":"@agentx-ai/agentx-js","version":"0.4.0","keywords":["agentx","ai","agents","workforce","sdk"],"author":{"name":"AgentX Team"},"license":"MIT","_id":"@agentx-ai/agentx-js@0.4.0","maintainers":[{"name":"robinxw","email":"robin@agentx.so"},{"name":"luis-agentx","email":"luis@agentx.so"}],"homepage":"https://www.agentx.so/","bugs":{"url":"https://github.com/AgentX-ai/agentx-js/issues"},"dist":{"shasum":"bdeba4df1deca5ce4cfe818beefc129ff7b6a8b1","tarball":"https://registry.npmjs.org/@agentx-ai/agentx-js/-/agentx-js-0.4.0.tgz","fileCount":39,"integrity":"sha512-/LnMsOfjdeiSnq4I3gvhaMi77VciUIUsBKvSLPJM7CDIhbNT0DHmS2UJufCjvUNmmYi4mUDSEXtJSuXeU68JBA==","signatures":[{"sig":"MEQCIBAbDyWFMPtzafsc92+mzlW74+2Sr5lTvLJSZ86SQ59+AiAlhZ0Q/gET7zu6Vbngh6EtbtdoVI4JJbIdBA8lGWAv0A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73649},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"5a58533cf0801e2d74cfe7ad029c8d00fee59fbb","scripts":{"dev":"ts-node src/index.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"luis-agentx","actor":{"name":"luis-agentx","type":"user","email":"luis@agentx.so"},"email":"luis@agentx.so"},"repository":{"url":"git+https://github.com/AgentX-ai/agentx-js.git","type":"git"},"_npmVersion":"10.9.2","description":"Official JavaScript/TypeScript SDK for AgentX (https://www.agentx.so/)","directories":{},"_nodeVersion":"22.13.1","author_email":"contact@agentx.so","dependencies":{"axios":"^1.6.0"},"_hasShrinkwrap":false,"devDependencies":{"ts-node":"^10.9.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agentx-js_0.4.0_1750886711084_0.18737357220947626","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@agentx-ai/agentx-js","version":"0.4.1","keywords":["agentx","ai","agents","workforce","sdk"],"author":{"name":"AgentX Team"},"license":"MIT","_id":"@agentx-ai/agentx-js@0.4.1","maintainers":[{"name":"robinxw","email":"robin@agentx.so"},{"name":"luis-agentx","email":"luis@agentx.so"},{"name":"marmichalak","email":"marcin@agentx.so"}],"homepage":"https://www.agentx.so/","bugs":{"url":"https://github.com/AgentX-ai/agentx-js/issues"},"dist":{"shasum":"663d6641814b46b5dcfe341a04b24b198ea51d4a","tarball":"https://registry.npmjs.org/@agentx-ai/agentx-js/-/agentx-js-0.4.1.tgz","fileCount":39,"integrity":"sha512-d+x7F2NA1+jb9m3buQ7NHUNeQJ3/INTwAg5Mla6bzB5jakakl05WRsXTYBCl6XC2g9GRinv/C+3nhTjIYSxVaQ==","signatures":[{"sig":"MEUCIQDcLHi/cQ3G6JtTZomFVJRiwYpCzRwyDQ7gQBBM9m0yGQIgF1hlFFxGkjL2MFvPtbLEtCbl9uNsv/WdTafQ842wmug=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76791},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"4e50114c23e212e1150f44fa55e252b4c45d3d68","scripts":{"dev":"ts-node src/index.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"robinxw","actor":{"name":"robinxw","type":"user","email":"robin@agentx.so"},"email":"robin@agentx.so"},"repository":{"url":"git+https://github.com/AgentX-ai/agentx-js.git","type":"git"},"_npmVersion":"11.4.2","description":"Official JavaScript/TypeScript SDK for AgentX (https://www.agentx.so/)","directories":{},"_nodeVersion":"24.2.0","author_email":"contact@agentx.so","dependencies":{"axios":"^1.6.0"},"_hasShrinkwrap":false,"devDependencies":{"ts-node":"^10.9.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agentx-js_0.4.1_1751495088918_0.9026664842534771","host":"s3://npm-registry-packages-npm-production"}},"0.4.2":{"name":"@agentx-ai/agentx-js","version":"0.4.2","keywords":["agentx","ai","agents","workforce","sdk"],"author":{"name":"AgentX Team"},"license":"MIT","_id":"@agentx-ai/agentx-js@0.4.2","maintainers":[{"name":"robinxw","email":"robin@agentx.so"},{"name":"luis-agentx","email":"luis@agentx.so"},{"name":"marmichalak","email":"marcin@agentx.so"}],"homepage":"https://www.agentx.so/","bugs":{"url":"https://github.com/AgentX-ai/agentx-js/issues"},"dist":{"shasum":"0f2919cd316f221058bc6050f1e408b2086fabbb","tarball":"https://registry.npmjs.org/@agentx-ai/agentx-js/-/agentx-js-0.4.2.tgz","fileCount":43,"integrity":"sha512-hMcWJFhKqM4t/HVePWbJzrAO5UJyt/ZH7gHi5gmsn5LJYAsHRj71JsUXORCfdJqFaCi/Q8F6P41c+YBIchITsg==","signatures":[{"sig":"MEYCIQDb+VtGhBTpMMqCWx3cVrm+EXJ8muAA0q+Cm+2lMx4SZwIhALagGvhCDRjOLMed7POQVhG2+gUn+heYKFgRDrlkPv5m","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90032},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"ad69b6775de77bb61df10a60a97e8f0c840235f8","scripts":{"dev":"ts-node src/index.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"robinxw","actor":{"name":"robinxw","type":"user","email":"robin@agentx.so"},"email":"robin@agentx.so"},"repository":{"url":"git+https://github.com/AgentX-ai/agentx-js.git","type":"git"},"_npmVersion":"11.4.2","description":"Official JavaScript/TypeScript SDK for AgentX (https://www.agentx.so/)","directories":{},"_nodeVersion":"24.2.0","author_email":"contact@agentx.so","dependencies":{"axios":"^1.6.0"},"_hasShrinkwrap":false,"devDependencies":{"ts-node":"^10.9.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agentx-js_0.4.2_1751497851855_0.7348541726575222","host":"s3://npm-registry-packages-npm-production"}},"0.4.3":{"name":"@agentx-ai/agentx-js","version":"0.4.3","description":"Official JavaScript/TypeScript SDK for AgentX (https://www.agentx.so/)","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","dev":"ts-node src/index.ts","test":"echo \"Error: no test specified\" && exit 1","prepublishOnly":"npm run build","bump:patch":"node scripts/bump-version.js patch","bump:minor":"node scripts/bump-version.js minor","bump:major":"node scripts/bump-version.js major"},"keywords":["agentx","ai","agents","workforce","sdk"],"author":{"name":"AgentX Team"},"author_email":"contact@agentx.so","license":"MIT","repository":{"type":"git","url":"git+https://github.com/AgentX-ai/agentx-js.git"},"homepage":"https://www.agentx.so/","dependencies":{"axios":"^1.6.0"},"devDependencies":{"@types/node":"^20.0.0","ts-node":"^10.9.0","typescript":"^5.0.0"},"engines":{"node":">=16.0.0"},"_id":"@agentx-ai/agentx-js@0.4.3","gitHead":"3077646f279c22966226765d6fedc90833eb987e","bugs":{"url":"https://github.com/AgentX-ai/agentx-js/issues"},"_nodeVersion":"18.20.8","_npmVersion":"10.8.2","dist":{"integrity":"sha512-jlWi+OIpxzBkMqNChipIgh1csmzDeAkNAAYLSAExMy6NDICJ3W/VtsGPn33YC36lsZHPEnAp6+AuaulBLfXMgw==","shasum":"d5c1fd139bf85746722dd3d750673679c3a2f2bf","tarball":"https://registry.npmjs.org/@agentx-ai/agentx-js/-/agentx-js-0.4.3.tgz","fileCount":45,"unpackedSize":97086,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD5/DjtJVtZO4wm/mbViU+IXEzyjNAP6E9bQClqmkivZQIhAI/sg5B65OLcbveYwrPZnE1EaK1cP85zfXbtvFXPztYp"}]},"_npmUser":{"name":"luis-agentx","email":"luis@agentx.so","actor":{"name":"luis-agentx","email":"luis@agentx.so","type":"user"}},"directories":{},"maintainers":[{"name":"robinxw","email":"robin@agentx.so"},{"name":"luis-agentx","email":"luis@agentx.so"},{"name":"marmichalak","email":"marcin@agentx.so"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agentx-js_0.4.3_1752095785507_0.05720261839721208"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-25T21:25:11.021Z","modified":"2025-07-09T21:16:25.940Z","0.4.0":"2025-06-25T21:25:11.278Z","0.4.1":"2025-07-02T22:24:49.110Z","0.4.2":"2025-07-02T23:10:52.037Z","0.4.3":"2025-07-09T21:16:25.691Z"},"bugs":{"url":"https://github.com/AgentX-ai/agentx-js/issues"},"author":{"name":"AgentX Team"},"license":"MIT","homepage":"https://www.agentx.so/","keywords":["agentx","ai","agents","workforce","sdk"],"repository":{"type":"git","url":"git+https://github.com/AgentX-ai/agentx-js.git"},"description":"Official JavaScript/TypeScript SDK for AgentX (https://www.agentx.so/)","maintainers":[{"name":"robinxw","email":"robin@agentx.so"},{"name":"luis-agentx","email":"luis@agentx.so"},{"name":"marmichalak","email":"marcin@agentx.so"}],"readme":"![Logo](https://agentx-resources.s3.us-west-1.amazonaws.com/AgentX-logo-387x60.png)\n\n[![npm version](https://img.shields.io/npm/v/@agentx-ai/agentx-js)](https://www.npmjs.com/package/@agentx-ai/agentx-js)\n\n---\n\n## Fast way to build AI Agents and create agent workforce\n\nThe official AgentX JavaScript/TypeScript SDK for [AgentX](https://www.agentx.so/)\n\nWhy build AI agent with AgentX?\n\n- Simplicity, Agent - Conversation - Message structure.\n- Include chain-of-thoughts.\n- Choose from most open and closed sourced LLM vendors.\n- Built-in Voice(ASR, TTS), Image Gen, Document, CSV/excel tool, OCR, etc.\n- Support all running MCP (model context protocol).\n- Support RAG with built-in re-rank.\n- Multi-agent workforce orchestration.\n- Multiple agents working together with a designated manager agent.\n- Cross vendor LLM orchestration.\n\n## Installation\n\n```bash\nnpm install @agentx-ai/agentx-js\n```\n\n## Usage\n\nProvide an `apiKey` inline or set `AGENTX_API_KEY` as an environment variable.\nYou can get an API key from https://app.agentx.so\n\n### Agent\n\n```typescript\nimport { AgentX } from '@agentx-ai/agentx-js';\n\nconst client = new AgentX(apiKey: \"<your api key here>\");\n\n// Get the list of agents you have\nconst agents = await client.listAgents();\nconsole.log(agents);\n```\n\n### Conversation\n\nEach Conversation has `agents` and `users` tied to it.\n\n```typescript\n// get agent\nconst myAgent = await client.getAgent(id: \"<agent id here>\");\n\n// Get the list of conversation from this agent\nconst existingConversations = await myAgent.listConversations();\nconsole.log(existingConversations);\n\n// Get the list of history messages from a conversation\nconst lastConversation = existingConversations[existingConversations.length - 1];\nconst msgs = await lastConversation.listMessages();\nconsole.log(msgs);\n```\n\n### Chat\n\nA `chat` needs to happen in the conversation. You can do `stream` response too, default `false`.\n\n```typescript\nconst aConversation = await myAgent.getConversation(id: \"<conversation id here>\");\n\n// Regular chat\nconst response = await aConversation.chat(\"Hello, what is your name?\");\n\n// Streaming chat\nconst stream = aConversation.chatStream(\"Hello, what is your name?\");\nfor await (const chunk of stream) {\n  console.log(chunk);\n}\n```\n\noutput looks like:\n\n```\n{ text: null, cot: 'The user is greeting and asking for my ', botId: 'xxx' }\n{ text: null, cot: 'name, which are casual, straightforward questions.', botId: 'xxx' }\n{ text: null, cot: ' I can answer these directly', botId: 'xxx' }\n{ text: 'Hello', cot: null, botId: 'xxx' }\n{ text: '!', cot: null, botId: 'xxx' }\n{ text: ' I', cot: null, botId: 'xxx' }\n{ text: ' am', cot: null, botId: 'xxx' }\n{ text: ' AgentX', cot: null, botId: 'xxx' }\n{ text: null, cot: null, botId: 'xxx' }\n```\n\n\\*`cot` stands for chain-of-thoughts\n\n### Workforce\n\nA Workforce (team) consists of multiple agents working together with a designated manager agent.\n\n```typescript\nimport { AgentX } from '@agentx-ai/agentx-js';\n\nconst client = new AgentX(apiKey: \"<your api key here>\");\n\n// Get the list of workforces/teams you have\nconst workforces = await AgentX.listWorkforces();\nconsole.log(workforces);\n\n// Get a specific workforce\nconst workforce = workforces[0]; // or any specific workforce\nconsole.log(`Workforce: ${workforce.name}`);\nconsole.log(`Manager: ${workforce.manager.name}`);\nconsole.log(`Agents: ${workforce.agents.map(agent => agent.name)}`);\n```\n\n#### Workforce Conversations\n\n```typescript\n// Create a new conversation with the workforce\nconst conversation = await workforce.newConversation();\n\n// List all existing conversations for the workforce\nconst conversations = await workforce.listConversations();\nconsole.log(conversations);\n```\n\n#### Chat with Workforce\n\nChat with the entire workforce team and get streaming responses from all agents.\n\n```typescript\n// Stream chat with the workforce\nconst stream = workforce.chatStream(\n  conversation.id,\n  \"How can you help me with this project?\"\n);\nfor await (const chunk of stream) {\n  if (chunk.text) {\n    process.stdout.write(chunk.text);\n  }\n  if (chunk.cot) {\n    console.log(` [COT: ${chunk.cot}]`);\n  }\n}\n```\n\nThe workforce chat allows you to leverage multiple specialized agents working together to provide comprehensive responses to your queries.\n\n## TypeScript Support\n\nThis SDK is written in TypeScript and provides full type definitions. All classes, interfaces, and methods are properly typed for better development experience.\n\n## API Reference\n\n### AgentX\n\nThe main client class for interacting with the AgentX API.\n\n#### Constructor\n\n- `new AgentX(apiKey?: string)` - Creates a new AgentX client instance\n\n#### Methods\n\n- `getAgent(id: string): Promise<Agent>` - Get a specific agent by ID\n- `listAgents(): Promise<Agent[]>` - List all agents\n- `getProfile(): Promise<any>` - Get the current user's profile\n- `static listWorkforces(): Promise<Workforce[]>` - List all workforces\n\n### Agent\n\nRepresents an individual AI agent.\n\n#### Properties\n\n- `id: string` - Agent ID\n- `name: string` - Agent name\n- `avatar?: string` - Agent avatar URL\n- `createdAt?: string` - Creation timestamp\n- `updatedAt?: string` - Last update timestamp\n\n#### Methods\n\n- `getConversation(id: string): Promise<Conversation>` - Get a specific conversation\n- `listConversations(): Promise<Conversation[]>` - List all conversations\n\n### Conversation\n\nRepresents a conversation between users and agents.\n\n#### Properties\n\n- `id: string` - Conversation ID\n- `title?: string` - Conversation title\n- `users: string[]` - User IDs in the conversation\n- `agents: string[]` - Agent IDs in the conversation\n- `createdAt?: string` - Creation timestamp\n- `updatedAt?: string` - Last update timestamp\n\n#### Methods\n\n- `newConversation(): Promise<Conversation>` - Create a new conversation\n- `listMessages(): Promise<Message[]>` - List all messages in the conversation\n- `chat(message: string, context?: number): Promise<any>` - Send a message\n- `chatStream(message: string, context?: number): AsyncGenerator<ChatResponse>` - Stream chat responses\n\n### Workforce\n\nRepresents a team of agents working together.\n\n#### Properties\n\n- `id: string` - Workforce ID\n- `name: string` - Workforce name\n- `agents: Agent[]` - List of agents in the workforce\n- `manager: Agent` - Manager agent\n- `description: string` - Workforce description\n- `image: string` - Workforce image URL\n\n#### Methods\n\n- `newConversation(): Promise<Conversation>` - Create a new workforce conversation\n- `listConversations(): Promise<Conversation[]>` - List all workforce conversations\n- `chatStream(conversationId: string, message: string, context?: number): AsyncGenerator<ChatResponse>` - Stream chat with workforce\n\n## Error Handling\n\nThe SDK throws descriptive errors for various failure scenarios:\n\n- Missing API key\n- Network errors\n- API errors (with status codes)\n- Invalid data\n\n```typescript\ntry {\n  const agent = await client.getAgent(\"invalid-id\");\n} catch (error) {\n  console.error(\"Error:\", error.message);\n}\n```\n\n## Environment Variables\n\n- `AGENTX_API_KEY` - Your AgentX API key (optional if passed to constructor)\n\n## Automated Publishing\n\nThis package uses GitHub Actions for automated publishing to npm. The workflow automatically:\n\n1. **Checks for version changes**: If `src/version.ts` is manually modified, it uses that version\n2. **Auto-bumps version**: If `src/version.ts` hasn't changed, it automatically bumps the patch version by 0.0.1\n3. **Builds and publishes**: Compiles TypeScript and publishes to npm\n4. **Creates releases**: Creates GitHub releases for manual version changes\n\n### Setup Required\n\nTo enable automated publishing, you need to set up the following secrets in your GitHub repository:\n\n1. **NPM_TOKEN**: Your npm authentication token\n\n   - Go to npmjs.com → Account → Access Tokens\n   - Create a new token with \"Automation\" type\n   - Add it as a repository secret named `NPM_TOKEN`\n\n2. **GITHUB_TOKEN**: This is automatically provided by GitHub Actions\n\n### How It Works\n\n- **Manual version bump**: Edit `src/version.ts` and push to main → triggers publish with your version\n- **Automatic version bump**: Push any changes to main without touching `src/version.ts` → automatically bumps patch version and publishes\n- **Manual trigger**: You can also manually trigger the workflow from the GitHub Actions tab\n\n### Version Management\n\n- The workflow reads the version from `package.json` and `src/version.ts`\n- When auto-bumping, it updates both files and commits the changes\n- The `[skip ci]` tag in commit messages prevents infinite loops\n\n## License\n\nMIT License\n","readmeFilename":"README.md"}