Skip to content

Tools

Create Tool

You can create custom tools using the create_tool method. Tools allow you to define custom integrations and actions that can be used within the Airia platform.

from airia import AiriaClient

client = AiriaClient(api_key="your_api_key")
# Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")

# Create a simple weather tool
tool = client.tools.create_tool(
    name="get_weather",
    description="Use this tool to get the current weather in a given location.",
    api_endpoint="https://api.weather.com/v1/current",
    method_type="Get",
    purpose="When a user asks about the weather, including current conditions.",
    body_type="None",
    category="Action"
)
print(f"Created tool: {tool.id}")
print(f"Tool name: {tool.name}")
print(f"Tool type: {tool.tool_type}")

Async Tool Creation

You can also create tools asynchronously using the async client:

import asyncio
from airia import AiriaAsyncClient

async def main():
    client = AiriaAsyncClient(api_key="your_api_key")

    # Create a tool asynchronously
    tool = await client.tools.create_tool(
        name="get_user_data",
        description="Retrieve user information from the database.",
        api_endpoint="https://api.example.com/users",
        method_type="Get",
        purpose="When user information is needed.",
        body_type="None",
        category="Action"
    )
    print(f"Created tool asynchronously: {tool.id}")

    await client.close()

asyncio.run(main())

Delete Tool

You can permanently delete tools using the delete_tool method:

from airia import AiriaClient

client = AiriaClient(api_key="your_api_key")
# Or with bearer token: client = AiriaClient.with_bearer_token(bearer_token="your_bearer_token")

# Delete a tool (permanently removes all data)
client.tools.delete_tool(tool_id="tool_123")
print("Tool deleted successfully")

Async Tool Deletion

You can also delete tools asynchronously using the async client:

import asyncio
from airia import AiriaAsyncClient

async def main():
    client = AiriaAsyncClient(api_key="your_api_key")

    # Delete a tool asynchronously
    await client.tools.delete_tool(tool_id="tool_123")
    print("Tool deleted successfully")

    await client.close()

asyncio.run(main())