@amitdeshmukh/ax-crew 3.8.1 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -0
- package/CHANGELOG.md +23 -0
- package/dist/agents/agentConfig.js +4 -2
- package/dist/agents/agentUseCosts.js +1 -1
- package/dist/agents/index.js +41 -34
- package/dist/config/index.js +7 -1
- package/package.json +2 -2
- package/src/agents/agentConfig.ts +4 -2
- package/src/config/index.ts +8 -1
- package/tsconfig.json +1 -1
package/.env.example
CHANGED
|
@@ -7,3 +7,6 @@ MISTRAL_API_KEY=sk-mistral-api********cQAA
|
|
|
7
7
|
GROK_API_KEY=sk-grok-api********cQAA
|
|
8
8
|
TOGETHER_API_KEY=sk-together-api********cQAA
|
|
9
9
|
HUGGINGFACE_API_KEY=sk-huggingface-api********cQAA
|
|
10
|
+
DEEPSEEK_API_KEY=sk-deepseek-api*****cQAA
|
|
11
|
+
REKA_API_KEY=sk-reka-api********cQAA
|
|
12
|
+
GROK_API_KEY=sk-grok-api*********cQAA
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,29 @@ This Changelog format is based on [Keep a Changelog]
|
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/
|
|
6
6
|
v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.10.0] - 2025-05-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Support for Reka AI models through `AxAIReka` provider
|
|
12
|
+
- Support for Grok (xAI) models through `AxAIGrok` provider
|
|
13
|
+
- Added `REKA_API_KEY` and `GROK_API_KEY` environment variable support
|
|
14
|
+
- Added `DEEPSEEK_API_KEY` environment variable support for DeepSeek models
|
|
15
|
+
- Enhanced provider configuration to include all supported AI providers
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Updated `src/config/index.ts` to include API keys for all supported providers
|
|
19
|
+
- Improved provider API key management for better consistency across all supported models
|
|
20
|
+
|
|
21
|
+
## [3.9.0] - 2025-05-28
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- Updated @ax-llm/ax package to 11.0.47
|
|
25
|
+
- Updated TypeScript target from ES2020 to ES2022 to resolve `ErrorOptions` type compatibility issue with @ax-llm/ax package
|
|
26
|
+
- Improved build process compatibility with latest TypeScript type definitions
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- Enhanced TypeScript configuration for better compatibility with modern type definitions
|
|
30
|
+
|
|
8
31
|
## [3.8.1] - 2024-03-28
|
|
9
32
|
|
|
10
33
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
// Import all the providers
|
|
3
|
-
import { AxAIAnthropic, AxAIOpenAI, AxAIAzureOpenAI, AxAICohere, AxAIDeepSeek, AxAIGoogleGemini, AxAIGroq, AxAIHuggingFace, AxAIMistral, AxAIOllama, AxAITogether } from '@ax-llm/ax';
|
|
3
|
+
import { AxAIAnthropic, AxAIOpenAI, AxAIAzureOpenAI, AxAICohere, AxAIDeepSeek, AxAIGoogleGemini, AxAIGroq, AxAIHuggingFace, AxAIMistral, AxAIOllama, AxAITogether, AxAIReka, AxAIGrok } from '@ax-llm/ax';
|
|
4
4
|
// Import the MCP client and transports
|
|
5
5
|
import { AxMCPClient, AxMCPStdioTransport, AxMCPHTTPTransport } from '@ax-llm/ax';
|
|
6
6
|
import { PROVIDER_API_KEYS } from '../config/index.js';
|
|
@@ -16,7 +16,9 @@ const AIConstructors = {
|
|
|
16
16
|
'mistral': AxAIMistral,
|
|
17
17
|
'ollama': AxAIOllama,
|
|
18
18
|
'openai': AxAIOpenAI,
|
|
19
|
-
'together': AxAITogether
|
|
19
|
+
'together': AxAITogether,
|
|
20
|
+
'reka': AxAIReka,
|
|
21
|
+
'grok': AxAIGrok
|
|
20
22
|
};
|
|
21
23
|
// Type guard to check if config is stdio transport
|
|
22
24
|
export function isStdioTransport(config) {
|
|
@@ -4,6 +4,7 @@ import { Decimal } from 'decimal.js';
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
export class StateFulAxAgentUsage {
|
|
7
|
+
static STATE_KEY_PREFIX = 'agent_usage_';
|
|
7
8
|
static calculateCost(modelUsage, modelInfo) {
|
|
8
9
|
// Handle both direct properties and nested tokens structure
|
|
9
10
|
const promptTokens = modelUsage.tokens?.promptTokens ?? modelUsage.promptTokens;
|
|
@@ -116,4 +117,3 @@ export class StateFulAxAgentUsage {
|
|
|
116
117
|
});
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
|
-
StateFulAxAgentUsage.STATE_KEY_PREFIX = 'agent_usage_';
|
package/dist/agents/index.js
CHANGED
|
@@ -5,6 +5,9 @@ import { parseCrewConfig, parseAgentConfig } from "./agentConfig.js";
|
|
|
5
5
|
import { StateFulAxAgentUsage } from "./agentUseCosts.js";
|
|
6
6
|
// Extend the AxAgent class from ax-llm
|
|
7
7
|
class StatefulAxAgent extends AxAgent {
|
|
8
|
+
state;
|
|
9
|
+
axai;
|
|
10
|
+
agentName;
|
|
8
11
|
constructor(ai, options, state) {
|
|
9
12
|
const { examples, ...restOptions } = options;
|
|
10
13
|
const formattedOptions = {
|
|
@@ -91,6 +94,11 @@ class StatefulAxAgent extends AxAgent {
|
|
|
91
94
|
* Represents a crew of agents with shared state functionality.
|
|
92
95
|
*/
|
|
93
96
|
class AxCrew {
|
|
97
|
+
crewConfig;
|
|
98
|
+
functionsRegistry = {};
|
|
99
|
+
crewId;
|
|
100
|
+
agents;
|
|
101
|
+
state;
|
|
94
102
|
/**
|
|
95
103
|
* Creates an instance of AxCrew.
|
|
96
104
|
* @param {CrewConfigInput} crewConfig - Either a path to the agent config file or a JSON object with crew configuration.
|
|
@@ -98,40 +106,6 @@ class AxCrew {
|
|
|
98
106
|
* @param {string} [crewId=uuidv4()] - The unique identifier for the crew.
|
|
99
107
|
*/
|
|
100
108
|
constructor(crewConfig, functionsRegistry = {}, crewId = uuidv4()) {
|
|
101
|
-
this.functionsRegistry = {};
|
|
102
|
-
/**
|
|
103
|
-
* Factory function for creating an agent.
|
|
104
|
-
* @param {string} agentName - The name of the agent to create.
|
|
105
|
-
* @returns {StatefulAxAgent} The created StatefulAxAgent instance.
|
|
106
|
-
* @throws Will throw an error if the agent creation fails.
|
|
107
|
-
*/
|
|
108
|
-
this.createAgent = async (agentName) => {
|
|
109
|
-
try {
|
|
110
|
-
const agentConfig = await parseAgentConfig(agentName, this.crewConfig, this.functionsRegistry, this.state);
|
|
111
|
-
// Destructure with type assertion
|
|
112
|
-
const { ai, name, description, signature, functions, subAgentNames, examples } = agentConfig;
|
|
113
|
-
// Get subagents for the AI agent
|
|
114
|
-
const subAgents = subAgentNames.map((subAgentName) => {
|
|
115
|
-
if (!this.agents?.get(subAgentName)) {
|
|
116
|
-
throw new Error(`Sub-agent '${subAgentName}' does not exist in available agents.`);
|
|
117
|
-
}
|
|
118
|
-
return this.agents?.get(subAgentName);
|
|
119
|
-
});
|
|
120
|
-
// Create an instance of StatefulAxAgent
|
|
121
|
-
const agent = new StatefulAxAgent(ai, {
|
|
122
|
-
name,
|
|
123
|
-
description,
|
|
124
|
-
signature,
|
|
125
|
-
functions: functions.filter((fn) => fn !== undefined),
|
|
126
|
-
agents: subAgents.filter((agent) => agent !== undefined),
|
|
127
|
-
examples,
|
|
128
|
-
}, this.state);
|
|
129
|
-
return agent;
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
throw error;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
109
|
// Basic validation of crew configuration
|
|
136
110
|
if (!crewConfig || typeof crewConfig !== 'object' || !('crew' in crewConfig)) {
|
|
137
111
|
throw new Error('Invalid crew configuration');
|
|
@@ -148,6 +122,39 @@ class AxCrew {
|
|
|
148
122
|
this.agents = new Map();
|
|
149
123
|
this.state = createState(crewId);
|
|
150
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Factory function for creating an agent.
|
|
127
|
+
* @param {string} agentName - The name of the agent to create.
|
|
128
|
+
* @returns {StatefulAxAgent} The created StatefulAxAgent instance.
|
|
129
|
+
* @throws Will throw an error if the agent creation fails.
|
|
130
|
+
*/
|
|
131
|
+
createAgent = async (agentName) => {
|
|
132
|
+
try {
|
|
133
|
+
const agentConfig = await parseAgentConfig(agentName, this.crewConfig, this.functionsRegistry, this.state);
|
|
134
|
+
// Destructure with type assertion
|
|
135
|
+
const { ai, name, description, signature, functions, subAgentNames, examples } = agentConfig;
|
|
136
|
+
// Get subagents for the AI agent
|
|
137
|
+
const subAgents = subAgentNames.map((subAgentName) => {
|
|
138
|
+
if (!this.agents?.get(subAgentName)) {
|
|
139
|
+
throw new Error(`Sub-agent '${subAgentName}' does not exist in available agents.`);
|
|
140
|
+
}
|
|
141
|
+
return this.agents?.get(subAgentName);
|
|
142
|
+
});
|
|
143
|
+
// Create an instance of StatefulAxAgent
|
|
144
|
+
const agent = new StatefulAxAgent(ai, {
|
|
145
|
+
name,
|
|
146
|
+
description,
|
|
147
|
+
signature,
|
|
148
|
+
functions: functions.filter((fn) => fn !== undefined),
|
|
149
|
+
agents: subAgents.filter((agent) => agent !== undefined),
|
|
150
|
+
examples,
|
|
151
|
+
}, this.state);
|
|
152
|
+
return agent;
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw error;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
151
158
|
/**
|
|
152
159
|
* Adds an agent to the crew by name.
|
|
153
160
|
* @param {string} agentName - The name of the agent to add.
|
package/dist/config/index.js
CHANGED
|
@@ -4,19 +4,25 @@ dotenv.config();
|
|
|
4
4
|
const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
|
|
5
5
|
const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
|
|
6
6
|
const COHERE_API_KEY = process.env.COHERE_API_KEY;
|
|
7
|
+
const DEEPSEEK_API_KEY = process.env.DEEPSEEK_API_KEY;
|
|
7
8
|
const GEMINI_API_KEY = process.env.GEMINI_API_KEY;
|
|
8
9
|
const GROQ_API_KEY = process.env.GROQ_API_KEY;
|
|
9
10
|
const TOGETHER_API_KEY = process.env.TOGETHER_API_KEY;
|
|
10
11
|
const MISTRAL_API_KEY = process.env.MISTRAL_API_KEY;
|
|
11
12
|
const HUGGINGFACE_API_KEY = process.env.HUGGINGFACE_API_KEY;
|
|
13
|
+
const REKA_API_KEY = process.env.REKA_API_KEY;
|
|
14
|
+
const GROK_API_KEY = process.env.GROK_API_KEY;
|
|
12
15
|
const PROVIDER_API_KEYS = {
|
|
13
16
|
COHERE_API_KEY,
|
|
14
17
|
GEMINI_API_KEY,
|
|
15
18
|
OPENAI_API_KEY,
|
|
16
19
|
ANTHROPIC_API_KEY,
|
|
20
|
+
DEEPSEEK_API_KEY,
|
|
17
21
|
GROQ_API_KEY,
|
|
18
22
|
TOGETHER_API_KEY,
|
|
19
23
|
MISTRAL_API_KEY,
|
|
20
|
-
HUGGINGFACE_API_KEY
|
|
24
|
+
HUGGINGFACE_API_KEY,
|
|
25
|
+
REKA_API_KEY,
|
|
26
|
+
GROK_API_KEY
|
|
21
27
|
};
|
|
22
28
|
export { PROVIDER_API_KEYS, };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@amitdeshmukh/ax-crew",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.10.0",
|
|
5
5
|
"description": "Build and launch a crew of AI agents with shared state. Built with axllm.dev",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"uuid": "^10.0.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@ax-llm/ax": "^11.0.
|
|
26
|
+
"@ax-llm/ax": "^11.0.47"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
// Import all the providers
|
|
3
|
-
import { AxAIAnthropic, AxAIOpenAI, AxAIAzureOpenAI, AxAICohere, AxAIDeepSeek, AxAIGoogleGemini, AxAIGroq, AxAIHuggingFace, AxAIMistral, AxAIOllama, AxAITogether } from '@ax-llm/ax';
|
|
3
|
+
import { AxAIAnthropic, AxAIOpenAI, AxAIAzureOpenAI, AxAICohere, AxAIDeepSeek, AxAIGoogleGemini, AxAIGroq, AxAIHuggingFace, AxAIMistral, AxAIOllama, AxAITogether, AxAIReka, AxAIGrok } from '@ax-llm/ax';
|
|
4
4
|
// Import Ax types
|
|
5
5
|
import type { AxFunction } from '@ax-llm/ax';
|
|
6
6
|
// Import the MCP client and transports
|
|
@@ -27,7 +27,9 @@ const AIConstructors: Record<string, any> = {
|
|
|
27
27
|
'mistral': AxAIMistral,
|
|
28
28
|
'ollama': AxAIOllama,
|
|
29
29
|
'openai': AxAIOpenAI,
|
|
30
|
-
'together': AxAITogether
|
|
30
|
+
'together': AxAITogether,
|
|
31
|
+
'reka': AxAIReka,
|
|
32
|
+
'grok': AxAIGrok
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
// Provider type
|
package/src/config/index.ts
CHANGED
|
@@ -5,11 +5,15 @@ dotenv.config();
|
|
|
5
5
|
const ANTHROPIC_API_KEY: string | undefined = process.env.ANTHROPIC_API_KEY;
|
|
6
6
|
const OPENAI_API_KEY: string | undefined = process.env.OPENAI_API_KEY;
|
|
7
7
|
const COHERE_API_KEY: string | undefined = process.env.COHERE_API_KEY;
|
|
8
|
+
const DEEPSEEK_API_KEY: string | undefined = process.env.DEEPSEEK_API_KEY;
|
|
8
9
|
const GEMINI_API_KEY: string | undefined = process.env.GEMINI_API_KEY;
|
|
9
10
|
const GROQ_API_KEY: string | undefined = process.env.GROQ_API_KEY;
|
|
10
11
|
const TOGETHER_API_KEY: string | undefined = process.env.TOGETHER_API_KEY;
|
|
11
12
|
const MISTRAL_API_KEY: string | undefined = process.env.MISTRAL_API_KEY;
|
|
12
13
|
const HUGGINGFACE_API_KEY: string | undefined = process.env.HUGGINGFACE_API_KEY;
|
|
14
|
+
const REKA_API_KEY: string | undefined = process.env.REKA_API_KEY;
|
|
15
|
+
const GROK_API_KEY: string | undefined = process.env.GROK_API_KEY;
|
|
16
|
+
// Note: Ollama typically doesn't require an API key for local usage
|
|
13
17
|
|
|
14
18
|
interface ProviderApiKeys {
|
|
15
19
|
[key: string]: string | undefined;
|
|
@@ -20,10 +24,13 @@ const PROVIDER_API_KEYS: ProviderApiKeys = {
|
|
|
20
24
|
GEMINI_API_KEY,
|
|
21
25
|
OPENAI_API_KEY,
|
|
22
26
|
ANTHROPIC_API_KEY,
|
|
27
|
+
DEEPSEEK_API_KEY,
|
|
23
28
|
GROQ_API_KEY,
|
|
24
29
|
TOGETHER_API_KEY,
|
|
25
30
|
MISTRAL_API_KEY,
|
|
26
|
-
HUGGINGFACE_API_KEY
|
|
31
|
+
HUGGINGFACE_API_KEY,
|
|
32
|
+
REKA_API_KEY,
|
|
33
|
+
GROK_API_KEY
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
export {
|