Skip to main content

Tool API Reference

The Tool API enables agents to interact with the outside world. While language models excel at reasoning and generating text, tools allow agents to perform real actions such as querying databases, calling APIs, reading files, or executing custom business logic. This page documents the public Tool API in BindAI.

Overview

A tool is a callable component that extends an agent’s capabilities. Conceptually:
Tools bridge AI reasoning and real-world operations.

Creating a Tool

A tool is typically implemented as a Python function or callable object. Example:
Once registered, the tool becomes available to agents.

Registering a Tool

Tools are usually registered at the project level. Example:
After registration, multiple applications and agents can reuse the same tool.

Tool Registry

Projects maintain a centralized tool registry.
The registry manages discovery and reuse of tools across the project.

Tool Execution

During agent execution, the language model may decide to invoke a tool.
The tool executes synchronously and returns its result to the agent.

Tool Inputs

Tools receive structured arguments supplied by the agent. Typical inputs include:
  • strings
  • numbers
  • booleans
  • dictionaries
  • lists
Input validation should always be performed before executing business logic.

Tool Outputs

A tool returns data back to the agent. Examples include:
  • text
  • JSON objects
  • structured records
  • search results
  • API responses
The returned value becomes part of the agent’s reasoning process.

Tool Context

Some tools require access to execution context. Conceptually:
Context-aware tools can read workflow variables or execution metadata when appropriate.

Tool Results

Tool execution may produce either:
Failures should be reported through structured exceptions or result objects rather than silently ignored.

Shared Tools

A single tool can be shared across multiple applications.
Sharing tools avoids duplicate implementations.

Local Tools

Some tools are specific to one application. Example:
These tools do not need to be registered globally if they are not reused elsewhere.

Tool Discovery

Agents only use tools that are explicitly registered or assigned to them. This improves:
  • security
  • predictability
  • performance
  • prompt clarity
Unused tools should not be exposed to every agent.

Error Handling

Tools should gracefully handle:
  • invalid input
  • unavailable services
  • authentication failures
  • network errors
  • unexpected exceptions
Returning meaningful errors makes workflows easier to debug.

Security

Because tools often interact with external systems, they should:
  • validate user input
  • sanitize parameters
  • limit permissions
  • protect secrets
  • avoid exposing internal resources
Tool security is critical in production deployments.

Performance

Well-designed tools should:
  • minimize network requests
  • cache expensive operations where appropriate
  • reuse existing connections
  • avoid unnecessary computation
Efficient tools improve the responsiveness of every agent that uses them.

Best Practices

  • Design each tool for a single responsibility.
  • Register reusable tools at the project level.
  • Validate all incoming arguments.
  • Return structured, predictable results.
  • Handle failures gracefully.
  • Keep tool interfaces stable.
  • Document expected inputs and outputs.

Related APIs

The Tool API integrates with:
  • Agent
  • Project
  • Workflow
  • Memory
  • Knowledge
Together they provide BindAI’s extensibility layer.

Summary

The Tool API extends BindAI agents beyond language generation. By connecting agents to databases, APIs, files, business systems, and custom logic, tools enable AI applications to perform meaningful real-world work while remaining reusable, secure, and easy to maintain.