File size: 1,036 Bytes
4b97c3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
"""
TokioAI Engine -- Custom Tools Example

Shows how to add your own tools to the engine.
Modify engine/schemas.py to add tool definitions,
or pass them through the API.
"""

from engine.pipeline import Pipeline, EngineConfig
from engine.schemas import TOOL_DEFINITIONS

# You can inspect the built-in tools
print("Built-in tools:")
for tool in TOOL_DEFINITIONS:
    name = tool["function"]["name"]
    desc = tool["function"]["description"][:60]
    print(f"  {name:20s} -- {desc}")

print()

# Use the engine normally -- it already knows all TokioAI tools
config = EngineConfig(
    model_name="qwen3-coder",
    verbose=True,
)
engine = Pipeline(config)

# The engine's router will classify this as tool_call
# and the guided generator will constrain output to valid tool names
result = engine.process("search for TODO comments in all python files")

print(f"\nResult: {result}")
if result.tool_calls:
    print(f"Tool: {result.tool_calls[0]['name']}")
    print(f"Args: {result.tool_calls[0]['arguments']}")