Skip to main content

A lightweight framework to expose any API as an agent-compatible tool

Project description

ToolPilot 🚀

A lightweight framework to expose any API as an agent-compatible tool. ToolPilot makes it easy to create tools that can be used by AI agents, with built-in support for OpenAI's MCP spec, LangChain, and CrewAI.

Features

  • 🎯 Simple decorator-based tool definition
  • 🔒 Built-in authentication handling
  • 📝 Automatic tool manifest generation
  • 🔄 Support for multiple agent frameworks
  • 🛠️ CLI for building and testing tools

Installation

pip install b2a-toolkit

Quick Start

  1. Define a tool using the @define_tool decorator:
from toolpilot import define_tool, ToolAuth

@define_tool(
    name="create_expense",
    description="Creates an expense in the system",
    inputs={
        "amount": "number",
        "category": "string",
        "description": "string",
        "date": "string"
    },
    output_type="object",
    output_description="The created expense object",
    auth=ToolAuth(
        type="oauth",
        required=True,
        scopes=["expenses:write"]
    )
)
def create_expense(amount: float, category: str, description: str, date: str):
    # Your implementation here
    return {"id": "exp_123", "amount": amount, ...}
  1. Build the tool manifest:
toolpilot build examples/expense_tool.py -o manifest.json
  1. Test the tool:
toolpilot test create_expense examples/expense_tool.py

Tool Definition

The @define_tool decorator takes the following parameters:

  • name: Name of the tool
  • description: Description of what the tool does
  • inputs: Dictionary mapping input parameter names to their types
  • output_type: Type of the tool's output
  • output_description: Description of the tool's output
  • auth: Optional authentication configuration
  • version: Version of the tool (default: "0.1.0")
  • tags: Optional list of tags/categories

Authentication

ToolPilot supports different authentication types:

  • OAuth
  • API Key
  • None (for public APIs)

Example OAuth configuration:

auth = ToolAuth(
    type="oauth",
    required=True,
    scopes=["expenses:write"]
)

CLI Commands

Build Manifest

toolpilot build <module_path> [--output <output_file>] [--format <json|openapi>]

Test Tool

toolpilot test <tool_name> <module_path>

Examples

Check out the examples/ directory for more examples:

  • expense_tool.py: A simple expense creation tool
  • More examples coming soon...

Current Capabilities

  • Tool Definition

    • Simple decorator-based API
    • Input/output validation
    • Type checking and conversion
    • Built-in documentation support
  • Authentication

    • OAuth support
    • API key support
    • Configurable scopes
    • Optional auth requirements
  • Manifest Generation

    • JSON format export
    • CLI tool for building manifests
    • Validation of tool definitions
    • Support for metadata and tags
  • Agent Framework Support

    • OpenAI MCP spec compatibility
    • LangChain tool format
    • CrewAI integration

Coming Soon 🚀

  • Enhanced Manifest Support

    • OpenAPI format export
    • GraphQL schema generation
    • Custom format plugins
    • Schema validation
  • Hosted Dashboard

    • Tool registry and discovery
    • Live testing interface
    • Usage analytics
    • Error tracking
  • Advanced Features

    • Rate limiting and quotas
    • Retry handling
    • Error recovery
    • Request/response logging
  • Enterprise Features

    • Team management
    • Access control
    • Audit logging
    • Custom authentication providers

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

b2a_toolkit-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

b2a_toolkit-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file b2a_toolkit-0.1.0.tar.gz.

File metadata

  • Download URL: b2a_toolkit-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for b2a_toolkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c2a397bf1744773d247b0b27f32174e8d22f081c97e36a72873132ee764f4717
MD5 d96f2b8162917416084b97b876202c1a
BLAKE2b-256 9b2539a9d38b16c9ddb56ae536cec0397d13236171035af7affb1b937f0b0e3a

See more details on using hashes here.

File details

Details for the file b2a_toolkit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: b2a_toolkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for b2a_toolkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7273b80e60536b1f36ec3cb00f75237dafaeb0cc405738340a5501939ace0f85
MD5 b091389a84fda9df28ea53e38e5a5e68
BLAKE2b-256 f0b83213916f9cfdadd68ceb226d453438351b32e5e8075320c0f3406fe857e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page