{"record":{"id":"b9cf882ecc4fbfdd","repo":"microsoft/semantic-kernel","slug":"type-type-is-not-allowed-in-bedrock-function-pa","errorCode":null,"errorMessage":"Type {type_} is not allowed in bedrock function parameter type. Allowed types are {BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES}.","messagePattern":"Type (.+?) is not allowed in bedrock function parameter type\\. Allowed types are (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/bedrock/action_group_utils.py","lineNumber":82,"sourceCode":"    \"array\",\n}\n\n\ndef kernel_function_parameter_type_to_bedrock_function_parameter_type(schema_data: dict[str, Any] | None) -> str:\n    \"\"\"Convert the kernel function parameter type to bedrock function parameter type.\"\"\"\n    if schema_data is None:\n        raise ValueError(\n            \"Schema data is required to convert the kernel function parameter type to bedrock function parameter type.\"\n        )\n\n    type_ = schema_data.get(\"type\")\n    if type_ is None:\n        raise ValueError(\n            \"Type is required to convert the kernel function parameter type to bedrock function parameter type.\"\n        )\n\n    if type_ not in BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES:\n        raise ValueError(\n            f\"Type {type_} is not allowed in bedrock function parameter type. \"\n            f\"Allowed types are {BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES}.\"\n        )\n\n    return type_\n\n\ndef parse_return_control_payload(return_control_payload: dict[str, Any]) -> list[FunctionCallContent]:\n    \"\"\"Parse the return control payload to a list of function call contents for the kernel.\"\"\"\n    return [\n        FunctionCallContent(\n            id=return_control_payload[\"invocationId\"],\n            name=invocation_input[\"functionInvocationInput\"][\"function\"],\n            arguments={\n                parameter[\"name\"]: parameter[\"value\"]\n                for parameter in invocation_input[\"functionInvocationInput\"][\"parameters\"]\n            },\n            metadata=invocation_input,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/bedrock/action_group_utils.py#L64-L100","documentation":"Raised by kernel_function_parameter_type_to_bedrock_function_parameter_type when converting a Semantic Kernel function parameter into a Bedrock ParameterDetail schema. Amazon Bedrock's agent-runtime ParameterDetail API only accepts a restricted set of JSON-schema types: string, number, integer, boolean, array (see BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES). Any kernel plugin function whose parameter type maps to something else (e.g. 'object', 'float', a dataclass/dict, or a custom type) fails this conversion.","triggerScenarios":"Called transitively during create_kernel_function_action_group -> kernel_function_to_bedrock_function_schema -> kernel_function_metadata_to_bedrock_function_schema -> kernel_function_parameter_to_bedrock_function_parameter -> kernel_function_parameter_type_to_bedrock_function_parameter_type. Fires when a registered plugin function declares a parameter whose schema_data['type'] is not in {string, number, integer, boolean, array}.","commonSituations":"Registering a plugin with a function that takes a dict/dataclass/Pydantic model/object parameter; using Python-native types (float, complex) that don't map to the allowed set; type annotations that resolve to 'object' in the generated schema; third-party plugins not designed for Bedrock constraints.","solutions":["Inspect the offending function's parameters and restrict each to one of: str, int, float (maps to 'number'), bool, or list (maps to 'array').","If a complex object is needed, flatten it into primitive parameters or serialize to a JSON string and parse inside the function.","Create a separate Bedrock-compatible wrapper function that exposes only allowed types, and register that one with the agent's kernel.","Run kernel_function_parameter_to_bedrock_function_parameter against each parameter in a dry-run before calling create_kernel_function_action_group to catch mismatches early."],"exampleFix":"// before\n@kernel_function(description=\"Create a user\")\ndef create_user(self, user: User) -> str:  # User is a dataclass -> type 'object' -> rejected\n    ...\n\n// after\n@kernel_function(description=\"Create a user\")\ndef create_user(self, name: str, age: int, email: str) -> str:  # primitives only\n    ...","handlingStrategy":"validation","validationCode":"from semantic_kernel.agents.bedrock.action_group_utils import BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES\n\ndef validate_function_params_for_bedrock(func) -> None:\n    for param in func.metadata.parameters:\n        schema = param.schema_data\n        t = schema.get(\"type\") if schema else None\n        if t not in BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES:\n            raise ValueError(\n                f\"Param '{param.name}' on '{func.metadata.fully_qualified_name}' \"\n                f\"has type '{t}', not allowed by Bedrock. Allowed: \"\n                f\"{BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES}\"\n            )\n\n# Run before create_kernel_function_action_group:\nfor f in kernel.get_list_of_function_metadata():\n    validate_function_params_for_bedrock(f)","typeGuard":"from semantic_kernel.agents.bedrock.action_group_utils import BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES\n\ndef is_bedrock_compatible_type(schema_data: dict | None) -> bool:\n    if schema_data is None:\n        return False\n    return schema_data.get(\"type\") in BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES","tryCatchPattern":"try:\n    await agent.create_kernel_function_action_group()\nexcept ValueError as e:\n    if \"not allowed in bedrock function parameter type\" in str(e):\n        # audit plugin functions and replace complex types with primitives\n        ...","preventionTips":["Design plugin functions with only str, int, float, bool, and list parameters from the start.","Run a pre-flight schema validation pass over all kernel functions before action-group creation.","Keep a Bedrock-compatible plugin variant separate from general-purpose plugins."],"tags":["bedrock","schema","function-calling","type-validation","action-group"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}