Kubiya tools are the fundamental building blocks of workflows, enabling both AI agents and developers to perform specific tasks and operations.
Every tool runs in its own isolated environment, providing deterministic and reliable execution.
Install the tools functionality with specific extras:
Copy
Ask AI
# Install with tools supportpip install kubiya-workflow-sdk[tools]# Install with all features (recommended)pip install kubiya-workflow-sdk[all]# For development with all tools featurespip install kubiya-workflow-sdk[dev,tools]
# 1. Install the SDK with tools support# pip install kubiya-workflow-sdk[tools]# 2. Create your first tool using the function_tool decoratorfrom kubiya_workflow_sdk.tools import function_tool@function_tool( description="Simple greeting tool", requirements=[])def greet(name: "str", greeting: "str" = "Hello") -> "str": """Generate a personalized greeting.""" return f"{greeting}, {name}!"# 3. The tool is automatically registered and ready to usefrom kubiya_workflow_sdk.tools import tool_registry# List registered toolstools = tool_registry.list_tools("default")print(f"Available tools: {[tool.name for tool in tools]}")# Get the toolgreeting_tool = tool_registry.get_tool("default", "greet")if greeting_tool: print(f"Tool description: {greeting_tool.description}")else: print("Tool not found")
Create native Python tools using the Tool class directly:
Copy
Ask AI
from kubiya_workflow_sdk.tools import Tool, Arg, FunctionTool, Source# Using FunctionTool classdef data_processor(input_data: str, format_type: str = "json") -> dict: """Process input data and return formatted output. Args: input_data: JSON string containing the data to process format_type: Output format type """ import json # Parse the JSON string to get the dictionary data_dict = json.loads(input_data) processed = { "original_keys": list(data_dict.keys()), "processed_at": "2024-01-01T00:00:00Z", "format": format_type, "item_count": len(data_dict) } return processed# Create tool from function with explicit argsprocessor_tool = Tool( name="data_processor", description="Process and format data", type="python", args=[ Arg(name="input_data", type="str", description="JSON string containing the data to process", required=True), Arg(name="format_type", type="str", description="Output format type", required=False, default="json") ], source=Source(id="local"), function=data_processor)# Register the toolfrom kubiya_workflow_sdk.tools import tool_registrytool_registry.register(processor_tool)