Agent.Tools
Tools API reference for the xpander SDK
Tool Methods
Methods for discovering, executing, and managing tools in the xpander SDK.
get_tools() / getTools()
Returns available tools, optionally formatted for a specific LLM provider.
Parameter | Type | Required | Description |
---|---|---|---|
llm_provider | LLMProvider enum | No | Format tools for a specific provider |
Returns: Array of tool objects formatted for the specified LLM provider.
Different LLM providers require specific tool formats. Always specify the appropriate provider:
LLMProvider.OPEN_AI
: For OpenAI models (GPT-3.5, GPT-4, GPT-4o)LLMProvider.ANTHROPIC
: For Anthropic Claude models directlyLLMProvider.GENERIC
: Generic provider formatLLMProvider.BEDROCK_CLAUDE
: Amazon Bedrock Claude modelsLLMProvider.VERTEX_AI
: Google Vertex AI modelsLLMProvider.FRIENDLI_AI
: For Claude models via FriendliAI APILLMProvider.GEMINI_OPEN_AI
: For Google Gemini with OpenAI format
run_tool() / runTool()
Executes a single tool by name with specified input parameters.
Parameter | Type | Required | Description |
---|---|---|---|
tool_name | string | Yes | Name of the tool to execute |
tool_input | object | Yes | Input parameters for the tool |
Returns: ToolCallResult
object containing the execution result.
run_tools() / runTools()
Executes multiple tool calls extracted from an LLM response.
Parameter | Type | Required | Description |
---|---|---|---|
tool_calls | array of ToolCall | Yes | Array of tool calls to execute |
Returns: Array of ToolCallResult
objects containing execution results.
add_tool_call_results() / addToolCallResults()
Adds tool execution results to the agent’s message history as tool messages.
Parameter | Type | Required | Description |
---|---|---|---|
tool_call_results | List[ToolCallResult] | Yes | Array of tool results |
Returns: void
This method is primarily needed for local tools whose results aren’t automatically reported to the platform. Cloud-based tools managed by the xpander.ai platform automatically add their results to the message history.
add_local_tools() / addLocalTools()
Adds custom, locally-implemented tools to the agent.
Parameter | Type | Required | Description |
---|---|---|---|
tools | array of objects | Yes | Array of tool definitions to add |
Returns: void
Tool Definition Object Properties
Property | Type | Required | Description |
---|---|---|---|
name | string | Yes | Unique name for the tool |
description | string | Yes | Description of what the tool does |
function | function | Yes | Reference to implementation function |
parameters | object | Yes | JSON Schema of function parameters |
Static Utility Methods
XpanderClient.format_tools() / formatTools()
Static utility method to format tools for various LLM providers.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
tools | array | Yes | Array of tool definitions |
llm_provider / llmProvider | LLMProvider | Yes | Enum value representing the LLM provider |
Returns
Returns tools formatted for the specified LLM provider.
XpanderClient.extract_tool_calls() / extractToolCalls()
Static utility for extracting tool calls from LLM responses.
Parameter | Type | Required | Description |
---|---|---|---|
llm_response | object | Yes | Raw response from the LLM |
llm_provider | LLMProvider | Yes | Provider that generated the LLM response |
Returns: Array of ToolCall
objects extracted from the LLM response.
Always use the same provider for extracting tool calls as you used for retrieving tools. The provider must match the LLM that generated the response.
XpanderClient.retrieve_pending_local_tool_calls() / retrievePendingLocalToolCalls()
Filters tool calls to retrieve only those that should be processed locally.
Parameter | Type | Required | Description |
---|---|---|---|
tool_calls | array of ToolCall | Yes | Array of tool calls to filter |
Returns: Array of ToolCall
objects that should be processed locally.
Agentic Interface Methods
retrieve_agentic_interfaces() / retrieveAgenticInterfaces()
Returns available connector interfaces that provide pre-built operations.
Returns: Array of AgenticInterface
objects representing available connectors.
retrieve_agentic_operations() / retrieveAgenticOperations()
Retrieves available operations from a specific interface.
Parameter | Type | Required | Description |
---|---|---|---|
agentic_interface | AgenticInterface | Yes | The interface to get operations from |
Returns: Array of Operation
objects available from the specified interface.
attach_operations() / attachOperations()
Attaches operations to the agent so they become available as tools.
Parameter | Type | Required | Description |
---|---|---|---|
operations | array of Operation | Yes | Array of operations to attach |
Returns: void
Type Definitions
ToolCall
Represents a tool call extracted from an LLM response.
ToolCallResult
Represents the result of executing a tool call.
AgenticInterface
Represents a connector interface that provides operations.
Operation
Represents a pre-built operation from an interface.