microsoft/semantic-kernel · error · ValueError
Type {type_} is not allowed in bedrock function parameter ty
Error message
Type {type_} is not allowed in bedrock function parameter type. Allowed types are {BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES}. What it means
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.
Source
Thrown at python/semantic_kernel/agents/bedrock/action_group_utils.py:82
"array",
}
def kernel_function_parameter_type_to_bedrock_function_parameter_type(schema_data: dict[str, Any] | None) -> str:
"""Convert the kernel function parameter type to bedrock function parameter type."""
if schema_data is None:
raise ValueError(
"Schema data is required to convert the kernel function parameter type to bedrock function parameter type."
)
type_ = schema_data.get("type")
if type_ is None:
raise ValueError(
"Type is required to convert the kernel function parameter type to bedrock function parameter type."
)
if type_ not in BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES:
raise ValueError(
f"Type {type_} is not allowed in bedrock function parameter type. "
f"Allowed types are {BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES}."
)
return type_
def parse_return_control_payload(return_control_payload: dict[str, Any]) -> list[FunctionCallContent]:
"""Parse the return control payload to a list of function call contents for the kernel."""
return [
FunctionCallContent(
id=return_control_payload["invocationId"],
name=invocation_input["functionInvocationInput"]["function"],
arguments={
parameter["name"]: parameter["value"]
for parameter in invocation_input["functionInvocationInput"]["parameters"]
},
metadata=invocation_input,View on GitHub (pinned to c028a0c7dc)
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.
Example fix
// before
@kernel_function(description="Create a user")
def create_user(self, user: User) -> str: # User is a dataclass -> type 'object' -> rejected
...
// after
@kernel_function(description="Create a user")
def create_user(self, name: str, age: int, email: str) -> str: # primitives only
... Defensive patterns
Strategy: validation
Validate before calling
from semantic_kernel.agents.bedrock.action_group_utils import BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES
def validate_function_params_for_bedrock(func) -> None:
for param in func.metadata.parameters:
schema = param.schema_data
t = schema.get("type") if schema else None
if t not in BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES:
raise ValueError(
f"Param '{param.name}' on '{func.metadata.fully_qualified_name}' "
f"has type '{t}', not allowed by Bedrock. Allowed: "
f"{BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES}"
)
# Run before create_kernel_function_action_group:
for f in kernel.get_list_of_function_metadata():
validate_function_params_for_bedrock(f) Type guard
from semantic_kernel.agents.bedrock.action_group_utils import BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES
def is_bedrock_compatible_type(schema_data: dict | None) -> bool:
if schema_data is None:
return False
return schema_data.get("type") in BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES Try / catch
try:
await agent.create_kernel_function_action_group()
except ValueError as e:
if "not allowed in bedrock function parameter type" in str(e):
# audit plugin functions and replace complex types with primitives
... Prevention
- 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.
When it happens
Trigger: 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}.
Common situations: 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.
Related errors
- No function results were returned.
- Failed to get a response from the agent. Please consider inc
- Function call is expected but not found in the response.
- Only FunctionChoiceType.AUTO is supported.
- Agent does not exist. Please create the agent before creatin
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/b9cf882ecc4fbfdd.
Report an issue: GitHub.