Arcade TDK

3.6.1 · active · verified Thu Apr 16

Arcade TDK (Toolkit Development Kit) is a Python library designed for defining and building custom tools for AI agents within the Arcade AI Platform. It provides decorators and utilities to easily expose Python functions as agent-callable tools, handling aspects like input/output schemas and execution context. The library maintains an active release cadence, with updates appearing every few weeks or months as part of the broader Arcade AI ecosystem.

Common errors

Warnings

Install

Imports

Quickstart

Defines a simple tool `add_numbers` using the `@tool` decorator. The function parameters are type-hinted and include a `ToolContext` for runtime information. This tool would then be hosted on an Arcade MCP server for consumption by AI agents.

from arcade_tdk.tool import tool, ToolContext
from typing import Annotated

@tool(
    description="Adds two numbers together."
)
def add_numbers(
    first_number: Annotated[float, "The first number to add."],
    second_number: Annotated[float, "The second number to add."],
    context: ToolContext # Required for Arcade platform functionality
) -> Annotated[float, "The sum of the two numbers."]:
    """Adds two numbers together."""
    print(f"Adding {first_number} and {second_number} for user {context.user_id}")
    return first_number + second_number

# In a real application, this tool would be served via an MCP server 
# and consumed by an AI agent using the `arcadepy` client.
# For example, an agent might call:
# client.tools.execute('my_toolkit.add_numbers', first_number=5, second_number=3, user_id='test_user')

# Example of how you might verify the function signature (not executed at runtime by TDK itself)
if __name__ == "__main__":
    # This part is for demonstration and would not typically be run directly for tool definition.
    # The Arcade platform handles discovery and execution.
    result = add_numbers(first_number=10, second_number=20, context=ToolContext(user_id='demo_user', tool_name='add_numbers'))
    print(f"Direct call result: {result}")

view raw JSON →