Skip to main content

Tools

Tools play a critical role in expanding an agent’s capabilities, enabling it to interact with external systems, process data, and perform complex tasks beyond the limitations of a standalone AI model. Instead of relying solely on language models, tools allow agents to:

  • Access external knowledge – Query APIs, retrieve structured data, and perform web searches.
  • Process multimodal inputs – Work with text, images, audio, and video using specialized AI models.
  • Execute computations – Perform mathematical calculations, run scripts, and analyze structured datasets.
  • Integrate with enterprise systems – Connect to CRMs, databases, and workflow automation platforms.

By leveraging tools, agents can move from passive text generators to autonomous decision-makers, executing tasks intelligently and efficiently. The following sections introduce different tool types and their integration into aiXplain agents.

Converting assets into tools

The aiXplain Marketplace offers a diverse range of assets that can be used as agent tools:

  • AI models – Pre-trained models, including LLMs, speech recognition, and speech synthesis, for various AI tasks.
  • Utilities – External APIs, webhooks, and third-party integrations that allow agents to retrieve and process real-time data.
  • Pipelines – Structured workflows that connect multiple AI assets for sequential or parallel execution, ensuring consistent and reliable behavior through predefined paths.
  • Data assets – Includes structured databases such as SQL and CSV files, as well as unstructured vector databases for indexing and retrieval.

Agents rely on clear tool signatures for effective selection and use. aiXplain Tools enable AI agents to access real-world data sources through a unified, scalable interface—eliminating the need for custom integrations.

When a marketplace asset is converted into a tool, its asset signature becomes the tool signature.

note

The tool’s name and description can be overridden in the create_<type>_tool method to better align with agent behavior.

Model tools

Models, including AI models and utilities, can be used as tools to enhance an agent’s capabilities. AI models such as LLMs, speech recognition, and synthesis enable tasks like summarization, translation, and text generation. Utilities, including external APIs, webhooks, and third-party integrations, allow agents to retrieve and process real-time data from external sources.

Browse for assets in the marketplace →

Example: LLM model as a tool

from aixplain.factories import AgentFactory

# Create a model tool
model_tool = AgentFactory.create_model_tool(
model="679a80334d6aa81bfab338b3", # Grok 2
description="A language model for text summarization." # Optional
)

# Add the tool to an existing agent
agent.tools.append(model_tool)

Learn more about asset listing →

Example: Scraper utility as a tool

from aixplain.factories import AgentFactory

# Create a scraper tool
scraper_tool = AgentFactory.create_model_tool(
model="6748e4746eb5633559668a15", # Firecrawl Scraper
description="Extracts text from a webpage."
)

# Add the tool to an existing agent
agent.tools.append(scraper_tool)

Configuring asset tools

When you add AI models or utilities as tools in an agent, each tool includes required and optional parameters.

What the agent can see

  • The tool’s name, description, and required parameters are always visible to the agent.

    • The agent can set or change required parameters at runtime.
  • Optional parameters are only visible if they have a value set before adding the tool.

    • These values are read-only—the agent can use them but can't change them at runtime.

Required parameters stay flexible for the agent to work with. Optional parameters act as fixed defaults or constraints to guide how the tool is used.

  search_utility = ModelFactory.get("6736411cf127849667606689") #Tavily Search API

model_params = search_utility.get_parameters()
print(model_params)

model_params.numResults = 7
model_params.include_domains = ["yelp.com"]
model_params.exclude_domains = ["google.com"]
print(model_params)

agent.tools.append(AgentFactory.create_model_tool(model=search_utility.id))

Custom tools

Agents in aiXplain can leverage custom tools to extend their functionality beyond marketplace assets, enabling bespoke logic execution dynamically. These custom functions run in a sandboxed environment, ensuring secure and isolated execution. The file size of the custom function should not exceed 10 MB.

note
  • At least one input parameter must be explicitly defined in the function.
  • All parameters are treated as required — default values are ignored.
  • Do not specify a return type using ->.
from aixplain.factories import AgentFactory

# The Python function must include all imports inside its body
def get_today_date(format: str):
"""Returns today's date in the specified format.

Parameters:
----------
format : str
The date format string (e.g., '%Y-%m-%d', '%d/%m/%Y').

Returns:
-------
str
The formatted date string.
"""
from datetime import datetime

return datetime.today().strftime(format)


# Convert function into a tool
date_tool = AgentFactory.create_custom_python_code_tool(
code=get_today_date,
description="Returns today's date") # Overrides the function's description in docstring

# Add tool to an existing agent
agent.tools.append(date_tool)
note

If name and/or description are not provided when using create_custom_python_code_tool, the function's name and docstring will be used as defaults.

Deploying a custom function as a utility

A custom Python function can be deployed as a private utility asset in aiXplain's marketplace, making it available for reuse across multiple agents.

  1. Define a Python function encapsulating the tool’s logic.
  2. Convert it into a Utility Asset using ModelFactory.create_utility_model.
  3. Deploy the tool—it will automatically appear in your dashboard with a unique asset ID and pricing.
  4. Add it to any agent using its asset ID via AgentFactory.create_model_tool.

Once deployed, the utility can be accessed privately within your workspace, enabling seamless integration into different agents without redefining the function each time.

from aixplain.factories import ModelFactory

# Deploy image_describer as a utility
date_utility = ModelFactory.create_utility_model(
name="Get date",
description="Returns today's date",
code=get_today_date
)

# Try it
# response = date_utility.run(
# data={
# "format": """%Y-%m-%d"""
# }
# )
# response.data

# Convert the utility to an agent tool
date_tool = AgentFactory.create_model_tool(model=date_utility.id)

# Add tool to an existing agent
agent.tools.append(date_tool)

Pipeline tools

Pipelines serve as structured workflows that connect multiple AI components, enabling agents to execute predefined sequences with precision. By incorporating pipelines, an agent's deterministic behavior is significantly improved, ensuring consistent and reliable task execution. Unlike standalone AI models, which generate responses probabilistically, pipelines enforce a fixed execution path, making them ideal for tasks that require repeatability, controlled processing, and structured decision-making.

Pipelines can be used for various applications, such as multi-step data processing, chained AI model execution, and complex automation workflows, providing a higher degree of predictability and efficiency. Learn more about pipelines here.

from aixplain.factories import AgentFactory

# Create a translation pipeline tool
translation_tool = AgentFactory.create_pipeline_tool(
pipeline="translation_pipeline_id",
description="A pipeline for translating text into multiple languages." # Optional
)

# Add the tool to an existing agent
agent.tools.append(translation_tool)

Python code interpreter tool

The Python Code Interpreter Tool enables agents to dynamically execute Python code, making them useful for solving mathematical problems, running computations, and handling errors.

from aixplain.factories import AgentFactory

# Create the python interpreter tool
code_interpreter_tool = AgentFactory.create_python_interpreter_tool()

# Add the tool to an existing agent
agent.tools.append(code_interpreter_tool)

Data tools

Data assets allow agents to query structured and unstructured data sources, making them useful for handling large datasets and knowledge retrieval.

Index (Vector Database) as a tool

More details on indexing can be found here.

from aixplain.factories import AgentFactory

# Create a index tool
index_tool = AgentFactory.create_model_tool(
model="<index_id>", # Vector Database
description="Index to query data"
)

# Add the tool to an existing agent
agent.tools.append(index_tool)

Best practices for tool invocation

Follow these tips to help your agent reliably select and use the right tools during execution:

Design meaningful and distinct tool schemas

Avoid ambiguity in tool names and parameters. Each tool should have:

  • Clear, action-oriented names (e.g., translate_text, not process_input)
  • Descriptive parameter names, with types, constraints, and example values
  • Non-overlapping responsibilities to reduce confusion

Tip: Include example inputs and outputs in the tool's description or custom function docstring to guide the agent more effectively.

Use tool choice hints in the agent’s instructions

Agents don’t always infer intent correctly—make usage conditions explicit. Give the agent explicit guidance on when and how to use each tool. For example:

Use extract_keywords when the user asks for main topics or key terms.
Use translate_text only if the user requests translation.

Add few-shot examples

Help the agent learn the expected pattern for tool invocation across different use cases. Show the agent how tools should be used by including example interactions:

User: What are the main points in this report?
Tool Call:
extract_keywords(text="This report covers market trends in AI...")

User: Translate this email to French.
Tool Call:
translate_text(text="Hello, how are you?", target_language="fr")

User: What’s the sentiment of this review?
Tool Call:
analyze_sentiment(text="The service was excellent and fast.")

Next

Now that you have a more capable agent,
learn how to run your agent with advanced settings and configurations →