Skip to content

Error Faced: The format for the tool name must be: \"httpVerb__actionGroupName__apiName\".}]","role":"user"}

0

I am getting repeated tool format name issue despite it says a tool of same type is available while executing agent with added action group.

I have added action group using 'Define with function details' and 'Define with API schemas' none of them seems to work, using 'Define with API schemas' got me closer to what agent is expecting tool name so I have attached it's traces but I am still not getting reponse and it is not able to trigger lambda function too.

The available action is GET__customer-support-agent__getCustomerId. (6) This action requires the email parameter, which is already provided by the User. (7) I have everything I need to proceed.}]","role":"assistant"},{"content":"[{text=The tool name format is incorrect. The format for the tool name must be: "httpVerb__actionGroupName__apiName".}]","role":"user"}

The available action is GET__customer-support-agent__getCustomerId. (6) This action requires the email parameter, which is already provided by the User. (7) I have everything I need to proceed.}]","role":"assistant"},{"content":"[{text=The tool name format is incorrect. The format for the tool name must be: "httpVerb__actionGroupName__apiName".}]","role":"user"}

Model used :- amazon.nova-pro-v1:0

Lambda Function (simple returns a random value, no deep logic) used attached below :-

import json, random

def unpack_parameters(parameters):
    result = {}
    for param in parameters:
        name = param.get("name")
        value = param.get("value")
        
        if name is not None:
            if value is not None:
                # Try to convert to int or float if possible
                try:
                    result[name] = int(value)
                except ValueError:
                    try:
                        result[name] = float(value)
                    except ValueError:
                        result[name] = value  # Keep as string if not a number
            else:
                result[name] = None  # Handle missing value
    
    return result

def lambda_handler(event, context):
    
    agent = event['agent']
    actionGroup = event['actionGroup']
    function = event['function']
    parameters = event.get('parameters', [])

    unpacked = unpack_parameters(parameters)

    responseBody =  {
        "TEXT": {
            "body": ""
        }
    }

    if function == "getCustomerId":
        email = unpacked.get("email", None)
        name = unpacked.get("name", None)
        phone = unpacked.get("phone", None)

        if any(value is not None and value != "" for value in (email, name, phone)):
            customer_id = random.randint(1000, 9999)
            responseBody['TEXT']['body'] = f"{{'id':{customer_id}}}"
        else:
            responseBody['TEXT']['body'] = "{'error':'Customer not found.'}"

    elif function == "sendToSupport":
        custId = unpacked.get("custId", None)
        supportSummary = unpacked.get("supportSummary", None)
        
        if all(value is not None and value != "" for value in (custId, supportSummary)):
            support_id = random.randint(1000, 9999)
            responseBody['TEXT']['body'] = f"{{'supportId': {support_id}}}"
        else:
            responseBody['TEXT']['body'] = "{'error':'Details missing.'}"

    else:
        responseBody['TEXT']['body'] = "{'error':'unknown function'}"


    action_response = {
        'actionGroup': actionGroup,
        'function': function,
        'functionResponse': {
            'responseBody': responseBody
        }

    }

    dummy_function_response = {'response': action_response, 'messageVersion': event['messageVersion']}
    print("Response: {}".format(dummy_function_response))

    return dummy_function_response
2 Answers
0
Accepted Answer

The issue was with the name of action group.
Causing Issue - customer-support-agent.
Correct approach - customerSupportAgent OR CustomerSupportAgent.
Rest all configuration is okay.

answered a year ago
AWS
SUPPORT ENGINEER
reviewed a year ago
0

It looks like you're experiencing a tool format name error with your Amazon Bedrock Agent. This error occurs when the model is trying to call a tool but isn't formatting the tool name correctly according to the required convention.

For Amazon Bedrock Agents, tool names must follow the format: "httpVerb__actionGroupName__apiName". The error suggests that the Nova Pro model is attempting to call your tool but isn't adhering to this format.

There are a few ways to troubleshoot this issue:

  1. Review your system prompt: The model might not be properly instructed on how to format tool calls. You may need to modify your system prompt to explicitly guide the model on the correct format for tool calls.

  2. Override default prompts: Since you're using Nova Pro, you might need to override the default prompts to better align with the model's capabilities. Nova models may have different prompting conventions than what Bedrock Agents expect by default.

  3. Check tool configuration: Ensure that your action group and API definitions in the Bedrock Agent are correctly configured. The tool names should match the format that the error message is expecting.

  4. Enable greedy decoding: If the model is not consistently returning the tool in the expected format, enabling greedy decoding might help produce more deterministic outputs.

  5. Validate inference parameters: Make sure the maximum token count is sufficient for the model to complete its response, including the properly formatted tool call.

Your Lambda function looks correctly structured to handle the parameters and functions, but the issue appears to be with how the model is attempting to call these functions rather than with the Lambda implementation itself.
Sources
Troubleshooting tool calls - Amazon Nova
Working with models not yet optimized for Amazon Bedrock Agents - Amazon Bedrock
Bedrock Agents - Powertools for AWS Lambda (TypeScript)

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.