import { MultiAgentOrchestrator } from "multi-agent-orchestrator";
const orchestrator = new MultiAgentOrchestrator();
orchestrator.addAgent(agent);
const response = await orchestrator.routeRequest(
"I need help with my order",
"user123",
"session456"
);
processing request: TypeError: (0 , MGt.setCredentialFeature) is not a function
at /var/task/index.js:12:34655
at e (/var/task/index.js:35:243)
at /var/task/index.js:1:38819
at coalesceProvider (/var/task/index.js:1:38997)
at /var/task/index.js:1:39199
at /var/task/node_modules/@smithy/core/dist-cjs/index.js:82:23
at async /var/task/index.js:1:7657
at async Oee.processRequest (/var/task/index.js:158:4342)
at async Oee.classify (/var/task/index.js:157:76)
at async o1e.routeRequest (/var/task/index.js:249:5168)
Code snippet
import {
MultiAgentOrchestrator,
LambdaAgent,
} from "multi-agent-orchestrator";
this.multiAgentOrchestrator = new MultiAgentOrchestrator();
const lambdaAgents = [ {
name: "system-generator",
description: `
An AI System Generator Agent to analyze business requirements and generate high-level system blueprints, breaking down complex processes into interconnected workflows.
`,
functionName: "system-generator",
functionRegion: "ap-south-1",
},
{
name: "workflow-generator",
description: `
An AI workflow Generator Agent to generate comprehensive, well-structured workflows based on given business cases or requirements.
functionName: "ai-workflow-generator",
functionRegion: "ap-south-1",
},
];
lambdaAgents.forEach((agentConfig) => {
const agent = new LambdaAgent(agentConfig);
this.multiAgentOrchestrator.addAgent(agent);
});
async processRequest(request: OrchestratorRequest): Promise<any> {
const { input, userId, sessionId } = request;
console.log('processRequest input, userId, sessionId:', input, userId, sessionId);
try {
const agentResponse = await this.multiAgentOrchestrator.routeRequest(
"HR team manage their organization’s recruitment process",
"user123",
"session456"
);
console.log("agentResponse in AI Orchestrator:", agentResponse);
return {
result: "Request processed successfully",
agentResponse,
};
} catch (error) {
console.error("Error in AI Orchestrator:", error);
throw error;
}
}
CDK code:
const aiOrchestrator = (
scope: Construct,
context: CDKContext,
layers: lambda.ILayerVersion[]
) => {
const handlerName = context.lambda.aiOrchestrator.name;
const entryPath = join(
__dirname,
`/../../src/lambda/${handlerName}/src/index.js`
);
return createNodeJsFunction(
scope,
handlerName,
context,
entryPath,
{
layers: [...layers],
memorySize: 512,
environment: {
ACCOUNT_NUMBER: context.accountNumber,
REGION: context.region,
},
timeout: Duration.minutes(3),
},
{
externalModulesArray: [
// "@aws-lambda-powertools/logger",
// "@aws-lambda-powertools/parameters",
],
nodeModulesArray: [
"@aws-sdk/client-cognito-identity-provider",
"@aws-sdk/client-sso",
"@aws-sdk/client-sts",
"@smithy/core",
"@aws-sdk/core",
],
}
);
};
export const createNodeJsFunction = (
scope: Construct,
handlerName: string,
context: CDKContext,
entry: string,
props: NodejsFunctionProps | undefined,
dependencies: Dependencies
): NodejsFunction => {
console.log(
"lambda path: ",
__dirname,
join(__dirname, `/../../src/lambda/${handlerName}/index.ts`)
);
return new NodejsFunction(scope, handlerName, {
entry: join(entry),
handler: "handler",
// functionName: `${handlerName}-${context.appName}-${context.environment}`,
functionName: `${handlerName}-${context.appName}`,
runtime: Runtime.NODEJS_16_X,
timeout: Duration.minutes(3),
bundling: {
externalModules: [...dependencies.externalModulesArray],
nodeModules: [...dependencies.nodeModulesArray], // Bundle AWS SDK v3 modules
minify: true, // Optional: Minimizes code
// target: "node18", // Set target as Node.js 18
// externalModules: [...externalModulesArray]
},
...props,
});
};
Bedrock Permission:
const bedrockPolicy = new iam.PolicyStatement({
actions: ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"], // Allow invocation of Bedrock models
//arn:aws:bedrock:ap-south-1::foundation-model/anthropic.claude-3-haiku-20240307-v1:0
resources: [`arn:aws:bedrock:${context.region}::foundation-model/*`], // Adjust the region, account ID, and model as needed
// resources: [`arn:aws:bedrock:${context.region}:${context.accountNumber}:model/*`], // Adjust the region, account ID, and model as needed
});
Package.json:
{
"name": "ai-orchestration-making",
"version": "1.0.0",
"description": "AI orchestration Lambda",
"main": "index.js",
"scripts": {
"test": "jest"
},
"dependencies": {
"@aws-sdk/client-cognito-identity-provider": "^3.675.0",
"@aws-sdk/client-sso": "^3.675.0",
"@aws-sdk/client-sts": "^3.675.0",
"@aws-sdk/core": "^3.666.0",
"@smithy/core": "^2.4.8",
"aws-lambda": "^1.0.7",
"multi-agent-orchestrator": "0.0.17"
},
"devDependencies": {
"@types/aws-lambda": "8.10.145",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"ts-jest": "^29.1.2"
}
}
Possible Solution
No response
Steps to Reproduce
try to run the code in a lambda runtime.
Tried in both node16 and 18. Both have same issues.
Expected Behaviour
https://awslabs.github.io/multi-agent-orchestrator/agents/built-in/lambda-agent/
Following instruction from this link should work.
Current Behaviour
import { MultiAgentOrchestrator } from "multi-agent-orchestrator"; const orchestrator = new MultiAgentOrchestrator(); orchestrator.addAgent(agent); const response = await orchestrator.routeRequest( "I need help with my order", "user123", "session456" );
processing request: TypeError: (0 , MGt.setCredentialFeature) is not a function at /var/task/index.js:12:34655 at e (/var/task/index.js:35:243) at /var/task/index.js:1:38819 at coalesceProvider (/var/task/index.js:1:38997) at /var/task/index.js:1:39199 at /var/task/node_modules/@smithy/core/dist-cjs/index.js:82:23 at async /var/task/index.js:1:7657 at async Oee.processRequest (/var/task/index.js:158:4342) at async Oee.classify (/var/task/index.js:157:76) at async o1e.routeRequest (/var/task/index.js:249:5168)
Code snippet
Possible Solution
No response
Steps to Reproduce
try to run the code in a lambda runtime. Tried in both node16 and 18. Both have same issues.