Skip to main content
API reference for creating and managing tools for AI Voice Agents.

Toolkit

A collection of tools that can be used by an agent.

Class

class
Toolkit
Groups related tools together with instructions for the agent.

Constructor

constructor
Toolkit()
Initialize a new Toolkit.

Parameters

name
str
default:"toolkit"
Descriptive name for the toolkit.
tools
List[Callable | Function]
default:"[]"
List of tools (callables or Function objects) to include.
instructions
str | None
default:"None"
Instructions for the toolkit. Helps the agent understand when and how to use these tools.
auto_register
bool
default:"True"
Automatically register all tools in the list.

Methods

register
None
Register a function with the toolkit.Parameters:
  • function (Callable | Function): Function to register
  • name (str | None): Optional custom name
Example:
toolkit = Toolkit(name="weather")
toolkit.register(get_weather)
get_functions
List[Function]
Get all registered functions.
get_function
Function | None
Get a function by name.Parameters:
  • name (str): Function name
Returns:
  • Function | None: Function if found, None otherwise

Usage Examples

from kuralit.tools import Toolkit

def get_weather(location: str) -> str:
    """Get weather for a location."""
    return f"Weather in {location}: sunny, 22°C"

# Create toolkit
weather_tools = Toolkit(
    name="weather",
    tools=[get_weather],
    instructions="Weather tools for getting current conditions"
)

# Use with agent
agent = AgentSession(
    tools=[weather_tools],
    # ...
)

Function

Model for storing functions that can be called by an agent.

Class

class
Function
Represents a single tool function that can be called by the agent.

Constructor

constructor
Function()
Create a Function object manually.

Parameters

name
str
required
Name of the function.
description
str | None
default:"None"
Description of what the function does.
parameters
Dict[str, Any]
default:"{}"
JSON Schema object describing function parameters.
entrypoint
Callable | None
default:"None"
The function to be called.
show_result
bool
default:"False"
If True, the function call will show the result.
stop_after_tool_call
bool
default:"False"
If True, the agent will stop after the function call.
requires_confirmation
bool
default:"False"
If True, the function will require confirmation before execution.
external_execution
bool
default:"False"
If True, the function will be executed outside the agent’s control.

Class Methods

from_callable
Function
Create a Function from a callable.Parameters:
  • c (Callable): Python function to convert
  • name (str | None): Optional custom name
Returns:
  • Function: Function object
Example:
def get_weather(location: str) -> str:
    """Get weather for a location."""
    return f"Weather in {location}: sunny"

tool = Function.from_callable(get_weather)

Methods

to_dict
Dict[str, Any]
Convert function to dictionary for API calls.Returns:
  • Dict[str, Any]: Function dictionary with name, description, parameters
__call__
Any
Call the function entrypoint.Parameters:
  • *args: Positional arguments
  • **kwargs: Keyword arguments
Returns:
  • Any: Function result
Raises:
  • ValueError: If entrypoint is None

Usage Examples

from kuralit.tools.function import Function

# Define function
def calculate(expression: str) -> str:
    """Calculate a mathematical expression."""
    return str(eval(expression))

# Convert to Function
tool = Function.from_callable(calculate)

# Use with toolkit
from kuralit.tools import Toolkit
calculator_tools = Toolkit(tools=[tool])

RESTAPIToolkit

Create tools from REST API endpoints (Postman collections).

Class

class
RESTAPIToolkit
Toolkit that loads REST API tools from Postman collections.

Class Methods

from_postman_collection
RESTAPIToolkit
Create RESTAPIToolkit from a Postman collection file.Parameters:
  • collection_path (str): Path to Postman collection JSON file
  • base_url (str): Base URL for API requests
  • headers (Dict[str, str] | None): Optional default headers
  • auth (Any | None): Optional authentication object
Returns:
  • RESTAPIToolkit: Toolkit with API tools
Example:
api_tools = RESTAPIToolkit.from_postman_collection(
    collection_path="api_collection.json",
    base_url="https://api.example.com",
    headers={"Authorization": "Bearer token"}
)

Usage Examples

from kuralit.tools.api import RESTAPIToolkit

# Load from Postman collection
api_tools = RESTAPIToolkit.from_postman_collection(
    collection_path="postman_collection.json",
    base_url="https://api.example.com",
    headers={
        "Authorization": "Bearer your-token",
        "Content-Type": "application/json"
    }
)

# Use with agent
agent = AgentSession(
    tools=[api_tools],
    # ...
)