Team Ai
Modelpublic

MrMoz33/tokioai-coder-iot

sourceHugging Facemitupdated 7d agoView on Hugging Face
0likes
custom_tools.py37 linesDownload Raw Back to examples
1#!/usr/bin/env python32"""3TokioAI Engine -- Custom Tools Example4 5Shows how to add your own tools to the engine.6Modify engine/schemas.py to add tool definitions,7or pass them through the API.8"""9 10from engine.pipeline import Pipeline, EngineConfig11from engine.schemas import TOOL_DEFINITIONS12 13# You can inspect the built-in tools14print("Built-in tools:")15for tool in TOOL_DEFINITIONS:16    name = tool["function"]["name"]17    desc = tool["function"]["description"][:60]18    print(f"  {name:20s} -- {desc}")19 20print()21 22# Use the engine normally -- it already knows all TokioAI tools23config = EngineConfig(24    model_name="qwen3-coder",25    verbose=True,26)27engine = Pipeline(config)28 29# The engine's router will classify this as tool_call30# and the guided generator will constrain output to valid tool names31result = engine.process("search for TODO comments in all python files")32 33print(f"\nResult: {result}")34if result.tool_calls:35    print(f"Tool: {result.tool_calls[0]['name']}")36    print(f"Args: {result.tool_calls[0]['arguments']}")37