-
Notifications
You must be signed in to change notification settings - Fork 671
Description
Expected Behaviour
The documentation for supervisorAgent.processRequest should accurately reflect the method's required parameters. The example code provided in the documentation should be runnable and not cause errors when used as described. Specifically, all mandatory arguments should be present in the example.
Current Behaviour
The current documentation for the supervisorAgent.processRequest method, found here, shows the following example:
const response = await supervisorAgent.processRequest(
"I need to modify my flight and check my refund status",
"user123",
"session456"
);
This example is missing the fourth mandatory argument, chatHistory. When attempting to use the method as documented, it results in the following error:
Error processing request: chatHistory is not iterable
Error in processRequest: Error processing request: chatHistory is not iterable
Error processing request: Error processing request: chatHistory is not iterable
This is because the actual implementation of processRequest in the package is:
async processRequest(inputText, userId, sessionId, chatHistory, additionalParams) {
// ... implementation details
}
As seen, chatHistory is a distinct parameter.
Code snippet
const response = await supervisorAgent.processRequest(
"I need to modify my flight and check my refund status",
"user123",
"session456"
);Possible Solution
Update the documentation to include the chatHistory argument in the method signature for supervisorAgent.processRequest.
Modify the example code in the documentation to include the chatHistory argument. For instance, if an empty array is a valid default or starting point for chatHistory, the example could be:
const response = await supervisorAgent.processRequest(
"I need to modify my flight and check my refund status",
"user123",
"session456",
[] // an empty array as chatHistory
);
Or, provide guidance on what chatHistory should typically contain or how it should be initialized.
Steps to Reproduce
- Go to the official documentation page for the Supervisor Agent: https://awslabs.github.io/agent-squad/agents/built-in/supervisor-agent/
- Locate the example code for supervisorAgent.processRequest.
- Implement and run this example code in a project where the agent-squad package is installed and the supervisorAgent is initialized.
- Observe that the code throws an "Error processing request: chatHistory is not iterable" because the chatHistory argument is not provided in the example, but is expected by the method.
- Compare the documented example with the method signature in the actual source code of agent-squad/src/agents/supervisor-agent.ts (or the compiled JavaScript equivalent).