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 move from passive text generators to autonomous decision-makers—capable of reasoning, planning, and acting in real-world environments.

Wrapping assets as 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 wrapped as 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

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.

AI model tools: LLM model

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)
agent.save() # To deploy changes

Utility tools: Scraper utility

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)
agent.save() # To deploy changes

Browse for assets in the marketplace → Learn more about asset listing →

Configuring tool parameters

When an agent uses a tool, it has access to the tool’s name, description, and its parameters. This information is derived from either the asset’s metadata or the docstring of an attached function. During execution, the agent can dynamically assign values to required parameters, but it can only read the default values of optional parameters—it cannot modify them at runtime.

To customize these parameters, you must configure them before wrapping the asset as a tool:

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

model_params = search_utility.get_parameters()
print(model_params)

# Set desired parameter values before creating the tool
model_params.numResults = 7
model_params.include_domains = ["yelp.com"]
model_params.exclude_domains = ["google.com"]
print(model_params)

# Wrap the configured model as a tool and add it to the agent
agent.tools.append(AgentFactory.create_model_tool(model=search_utility.id))
agent.save() # To deploy changes

Optional parameters act as constraints or defaults to guide tool usage. Required parameters stay flexible, allowing the agent to adapt them based on the task.

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)


# Wrap the function as 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 the tool to an existing agent
agent.tools.append(date_tool)
agent.save() # To deploy changes
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

Alternatively, 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 utility’s logic.
  2. Convert it into a Utility Asset.
  3. Deploy it—it will automatically appear in your dashboard with a unique asset ID and pricing.
  4. Wrap it as a tool to add it to an agent.
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

date_utility.deploy()

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

# Add the tool to an existing agent
agent.tools.append(date_tool)
agent.save() # To deploy changes

'create_utility_model()' initializes a draft utility with a temporary endpoint valid for 24 hours. The utility will appear in the owner's dashboard. To create a permanent endpoint, use the 'deploy()' method. View the deployed utility in your dashboard: https://platform.aixplain.com/discover/utility/<date_utility.id>

Learn more about deploying custom assets →

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.

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)
agent.save() # To deploy changes

Learn more about pipelines →.

Python code interpreter tool

The Python Code Interpreter Tool is a prebuilt tool in the aiXplain agentic framework. It allows agents to execute Python code dynamically within a sandboxed environment.

This is particularly useful when the LLM generates code as part of the task—for example, solving a math problem, transforming data, or performing logic operations. The agent can generate code on the fly and use this tool to safely run it during execution.

from aixplain.factories import AgentFactory

# Create the Python interpreter tool (no configuration needed)
code_interpreter_tool = AgentFactory.create_python_interpreter_tool()

# Add the tool to an existing agent
agent.tools.append(code_interpreter_tool)
agent.save() # To deploy changes

No deployment is required—the interpreter is ready to use and enhances the agent’s ability to reason, calculate, and manipulate data programmatically.

Data tools

Data assets allow agents to query both structured and unstructured data sources. For example, an agent can pull customer records from a structured CRM database or extract policy information from unstructured sources like PDFs, emails, or knowledge base articles.

By integrating data assets, agents can ground their responses in trusted knowledge, retrieve contextually relevant information, and help reduce hallucinations. This foundation is critical for building Agentic RAG systems—agents that reason, retrieve, and respond using verified, context-aware information.

Index (Vector Database) as a tool

Unstructured data can be indexed using embeddings in a vector database, allowing agents to perform fast, semantic search across large corpora.

from aixplain.factories import AgentFactory

# Create an 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)
agent.save() # To deploy changes

Learn how to index your data →.

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

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 effectively →