Introduction
AI assistants become truly powerful when they can interact with the real world through tool calling. SINAS makes it easy to equip your assistants with custom capabilities by enabling them to call Python functions, trigger webhooks, invoke other assistants, and use Model Context Protocol (MCP) tools.
Creating an Assistant with Tools
When creating an assistant, you can specify which tools it has access to:
POST /api/v1/assistants
{
"name": "Customer Support Bot",
"provider": "openai",
"model": "gpt-4",
"system_prompt": "You are a helpful customer support agent...",
"enabled_webhooks": ["search-docs", "create-ticket"],
"enabled_mcp_tools": ["filesystem", "database"],
"enabled_assistants": ["data-analyst-assistant"],
"webhook_parameters": {
"search-docs": {
"index": "customer-docs"
}
}
}
How Tool Calling Works
When a user sends a message, the assistant can decide to call one or more tools based on the conversation context. SINAS automatically handles:
- Tool discovery and schema generation
- Executing the tool with the assistant's parameters
- Injecting the tool response back into the conversation
- Continuing the conversation with the tool results
Types of Tools
1. Webhooks
Webhooks are HTTP endpoints that trigger function execution. Perfect for custom business logic:
// Webhook "search-docs" triggers a Python function
def search_documentation(query, index):
results = vector_search(query, index)
return {
"results": results,
"count": len(results)
}
2. Python Functions
Direct function calls with automatic execution tracking and versioning:
def calculate_shipping_cost(weight, destination):
base_rate = get_base_rate(destination)
return base_rate * weight * 1.15
3. MCP Tools
Model Context Protocol tools provide standardized capabilities like filesystem access, database queries, or external API integrations.
4. Other Assistants
Assistants can call other specialized assistants, enabling agent orchestration and delegation of complex tasks.
Per-Message Tool Configuration
You can override tool enablement on a per-message basis:
POST /api/v1/chats/{chat_id}/messages
{
"content": "Search our documentation for RAG patterns",
"enabled_webhooks": ["search-docs"],
"disabled_webhooks": ["create-ticket"]
}
Best Practices
- Clear tool names: Use descriptive names that help the AI understand when to use each tool
- Good descriptions: Provide detailed descriptions in your function/webhook schemas
- Input validation: Use JSON schemas to validate tool inputs
- Error handling: Return helpful error messages that the assistant can communicate to users
- Scoped permissions: Use tool parameters to limit what each assistant can access
Next Steps
Start building your first tool-enabled assistant by combining SINAS's function execution system with AI assistants. Check out our documentation for complete API references and more examples.