Get Sorted Tool Schemas • AI Agent SDK
get_sorted_tool_schemas: Get tool schemas sorted by function name for deterministic ordering.
get_sorted_tool_schemas
Function
</div>
This function is defined in the base module.
Get tool schemas sorted by function name for deterministic ordering.
This ensures tool schemas are always ordered consistently for prompt caching optimization.
Signature
def get_sorted_tool_schemas(tools: List[Any]) -> List[Dict[str, Any]]Parameters
ParamField
List[Any]List of tool objects (BaseTool instances, callables, etc.)
Returns
ResponseField
List[Dict[str, Any]]List of tool schemas sorted alphabetically by function name
Exceptions
ToolValidationError
If validation fails
Uses
validate_tool_schema_consistency
Source
View on GitHubpraisonaiagents/tools/base.py at line 589