agent-squad icon indicating copy to clipboard operation
agent-squad copied to clipboard

Bug: Handling Streaming with SupervisorAgent and TeamMember

Open pierrehanne opened this issue 10 months ago • 2 comments

Expected Behaviour

I have created an AWS Lambda function using Node.js to enable native streaming responses. The Lambda function leverages an AgentSupervisor composed of multiple BedrockLLMAgent instances.

  • The AgentSupervisor is built using BedrockLLMAgent (Claude 3.5 Sonnet).
  • It manages a team of BedrockLLMAgents (Claude 3 Haiku).
  • Streaming is explicitly set to true for all agents.

The SupervisorAgent should return a streaming response as its underlying agents are all configured for streaming.

Current Behaviour

Despite enabling streaming for all agents, I expect the SupervisorAgent to return a streaming response, but it does not appear to work as expected.

"error": "Error getting stream from Bedrock model: this.toolConfig.useToolHandler is not a function", "stack": "Error: Error getting stream from Bedrock model: this.toolConfig.useToolHandler is not a function\n at MultiAgentOrchestrator.processStreamInBackground (/opt/nodejs/node_modules/multi-agent-orchestrator/dist/orchestrator.js:222:46)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)"

Code snippet

// Create orchestrator
const orchestrator = new MultiAgentOrchestrator();

// Create supervisor (lead agent)
const supervisor = new BedrockLLMAgent({
  name: "Team Lead",
  description: "Coordinates specialized team members",
  modelId: "anthropic.claude-3-5-sonnet-20240620-v1:0",
  streaming: true
});

// Create team members
const techAgent = new BedrockLLMAgent({
  name: "Tech Support",
  description: "Handles technical issues",
  modelId: "anthropic.claude-3-haiku-20240307-v1:0",
  streaming: true
});

const billingAgent = new BedrockLLMAgent({
  name: "Billing Expert",
  description: "Handles billing and payment queries",
  modelId: "anthropic.claude-3-haiku-20240307-v1:0",
  streaming: true
});

// Create SupervisorAgent
const supervisorAgent = new SupervisorAgent({
  leadAgent: supervisor,
  team: [techAgent, billingAgent],
});

// Add supervisor agent to orchestrator
orchestrator.addAgent(supervisorAgent);

Possible Solution

No response

Steps to Reproduce

  1. Create an AWS Lambda function using Node.js.
  2. Implement an AgentSupervisor composed of BedrockLLMAgent agents.
  3. Set the streaming configuration to true for all agents.
  4. Invoke the SupervisorAgent and observe the response behavior.

pierrehanne avatar Feb 25 '25 14:02 pierrehanne

Thanks for your issue. This is going to be fixed in #278

brnaba-aws avatar Apr 03 '25 12:04 brnaba-aws

Any update on this? i am still getting the same error in Typescript package

Image

SaqibInTech avatar May 09 '25 20:05 SaqibInTech