Tools API reference for the xpander SDK
Methods for discovering, executing, and managing tools in the xpander SDK.
Returns available tools, optionally formatted for a specific LLM provider.
Parameter | Type | Required | Description |
---|
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 formatExecutes 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.
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.
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.
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
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 method to format tools for various LLM providers.
Parameter | Type | Required | Description |
---|---|---|---|
tools | array | Yes | Array of tool definitions |
Returns tools formatted for the specified LLM provider.
Extracts tool calls from an LLM response using the agent’s selected provider.
Parameter | Type | Required | Description |
---|---|---|---|
llm_response | object | Yes | Raw response from the LLM |
llm_provider / llmProvider | LLMProvider | No | Provider used to parse the response |
The agent automatically uses its configured LLM provider when llm_provider
is omitted. Change it with agent.select_llm_provider()
if you need to parse a response from another provider. You can also call XpanderClient.extract_tool_calls()
directly when working without an agent.
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.
Returns available connector interfaces that provide pre-built operations.
Returns: Array of AgenticInterface
objects representing available connectors.
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.
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
Represents a tool call extracted from an LLM response.
Represents the result of executing a tool call.
Represents a connector interface that provides operations.
Represents a pre-built operation from an interface.
Core agent functionality
Working with agent messages
Managing agent tasks
Main client for the xpander.ai SDK
Token usage metrics
Execution statistics
For more examples of tool definitions and usage, see the xpander-sdk tool docs.