Shared Tools
Shared Tools are reusable tool implementations that can be used by multiple agents, workflows, or applications. Instead of duplicating the same functionality across different parts of an AI system, a shared tool can be implemented once and reused wherever it is appropriate. This improves consistency, maintainability, testing, and code reuse.What Are Shared Tools?
A shared tool is a reusable tool implementation that is intentionally made available to multiple consumers. Conceptually:SharedTool class.
Why Use Shared Tools?
Without reusable tools, applications may duplicate the same functionality. For example:- Less code duplication
- Consistent behavior
- Centralized maintenance
- Easier testing
- Simpler upgrades
- Reusable business logic
BindAI Tool Registry
BindAI provides a tool registry for registering and resolving tools. Conceptually:Sharing a Tool Between Agents
A reusable tool can be configured for more than one agent. Conceptually:Shared Tools and Workflows
Tools can also be reused by workflow operations. For example:Shared Tools and Applications
Applications can organize common tools for use across multiple application boundaries. Conceptually:Shared Tools vs Local Tools
Not every tool needs to be shared.
If a tool is only used once, keeping it close to the agent or workflow that owns it may be simpler.
Typical Shared Tools
Common candidates for reuse include:- Database queries
- Search
- Document retrieval
- Email delivery
- Calendar operations
- File storage
- CRM operations
- Internal APIs
- Notification services
- Data transformation
- Analytics utilities
Shared Tools and Connections
A shared tool can use a BindAI Connection to communicate with an external service. For example:Shared Tools and Knowledge
Knowledge retrieval can also be exposed through reusable tools when an application requires tool-based access. For example:Shared Tools and Memory
Tools can interact with memory when an application explicitly provides the required memory capability. For example:Tool Interfaces
Shared tools should have stable, understandable interfaces. A typical tool should define:- A clear name
- Explicit parameters
- Useful type hints
- A focused responsibility
- A descriptive docstring
- Predictable results
- Safe error handling
Avoiding Hidden Dependencies
Shared tools should avoid depending on hidden global state. Prefer explicit inputs:Configuration
Shared tools may require configuration such as:- API endpoints
- Database connections
- Service identifiers
- Feature settings
- Environment-specific behavior
Security
Shared tools can expose powerful capabilities. Examples include:- Database writes
- Customer data access
- File operations
- Payment operations
- External API calls
- Administrative actions
- Input validation
- Authorization
- Least privilege
- Sensitive-data handling
- Safe error messages
- Audit logging
- Rate limiting
- Idempotency for important operations
Read vs Write Tools
A useful distinction is between read-only and state-changing operations.Read
Write
Idempotency
Shared tools that perform external side effects should consider idempotency. For example:- Idempotency keys
- Duplicate detection
- Stable operation identifiers
- Transactional behavior
Versioning
A shared tool may have many consumers. For example:- Preserve compatibility when possible.
- Test all important consumers.
- Document interface changes.
- Avoid unnecessary breaking changes.
- Introduce new interfaces deliberately.
Performance
Frequently used shared tools should be designed with performance in mind. Consider:- Caching
- Connection pooling
- Batching
- Async execution where appropriate
- Reducing unnecessary network calls
- Avoiding repeated expensive computation
Error Handling
Shared tools should return predictable results and handle failures safely. Potential failures include:- Invalid input
- Network errors
- Authentication failures
- External service errors
- Database errors
- Rate limits
- Timeouts
Testing Shared Tools
Shared tools should be tested independently of the agents that consume them. Recommended tests include:- Valid inputs
- Invalid inputs
- Boundary cases
- External-service failures
- Authentication failures
- Timeouts
- Duplicate requests
- Side effects
- Security restrictions
Reuse Across Agents
A shared tool should remain independent of a particular agent. Good:Organizing Shared Tools
As a project grows, tools can be organized into logical modules. For example:Shared Tools and Middleware
Shared tools can be used alongside agent middleware and other execution controls. For example:Shared Tools and Workflows
A shared tool can participate in larger workflows:When Not to Share a Tool
Sharing is not always the right choice. Keep a tool local when:- It is highly specific to one agent.
- Its interface changes frequently.
- Its behavior depends heavily on local state.
- Its permissions are unique to one application.
- Reuse would introduce unnecessary coupling.
Best Practices
- Share tools that represent genuinely reusable capabilities.
- Keep each tool focused on one responsibility.
- Use explicit parameters and type hints.
- Keep shared interfaces stable.
- Avoid hidden global state.
- Separate configuration from implementation.
- Protect sensitive operations.
- Prefer least-privilege access.
- Make external side effects idempotent where possible.
- Test shared tools independently.
- Document breaking changes.
- Keep tool organization modular.
Current BindAI Scope
BindAI provides the underlying tool abstractions required for reusable tools. The current tool system includes:- Tool definitions
- Tool registration
- Tool registries
- Tool execution
- Tool results
- Agent tool integration
- Multiple tools per agent
SharedTool runtime abstraction.
API Accuracy
This document intentionally avoids assuming a project-level API such as:search_tool object or implementation can be reused by another agent.
