Introduction

The Tools Repository Module is designed for managing and integrating external tools and services within AI agents.

Overview

With this module, you can:
  • Manage and register local tools
  • Discover and retrieve existing tools by ID
  • Check synchronization requirements with the backend
  • Use configuration settings to integrate tools seamlessly

Examples

Tool Registration

Learn how to register a local tool with both asynchronous and synchronous approaches.

Asynchronous Example

Using register_tool():
from xpander_sdk import register_tool

@register_tool
def analyze_data(data: dict) -> dict:
    return {"status": "completed", "data_processed": len(data)}

Synchronous Example

Using register_tool():
from xpander_sdk import register_tool

@register_tool
def summarize_data(data: dict) -> dict:
    return {"status": "completed", "summary": len(data)}

Tool Invocation

Invoke a tool using both async and sync methods.

Asynchronous Example

from xpander_sdk import ToolsRepository

tools_repo = ToolsRepository()
tool = await tools_repo.ainvoke(
    agent_id="agent-123",
    payload={"param": "value"}
)
print(f"Invocation success: {tool.is_success}")

Synchronous Example

from xpander_sdk import ToolsRepository

tools_repo = ToolsRepository()
tool = tools_repo.invoke(
    agent_id="agent-123",
    payload={"param": "value"}
)
print(f"Invocation success: {tool.is_success}")

Continue to the Tools API Reference for detailed documentation on classes and methods.

Support

For additional help: