Skip to main content

A toolkit for implementing and managing tools for LLM agents

Project description

Minion-Manus

A toolkit for implementing and managing tools for LLM agents.

Overview

Minion-Manus provides a flexible and extensible system for creating, managing, and using tools with Large Language Models (LLMs). It offers a standardized way to define tools, validate their inputs and outputs, and integrate them with various LLM frameworks.

Key features:

  • Simple class-based API for defining tools
  • Support for both synchronous and asynchronous execution
  • Schema validation for inputs and outputs
  • Adapters for integration with other tool frameworks
  • Comprehensive type hints and documentation

Installation

pip install minion-manus

Basic Usage

Creating a Tool

from minion_manus.tools import Tool

class CalculatorTool(Tool):
    name = "calculator"
    description = "Perform mathematical calculations"
    inputs = {
        "expression": {
            "type": "string",
            "description": "Mathematical expression to evaluate",
            "required": True
        }
    }
    output_type = "number"
    
    def _execute(self, expression: str) -> float:
        return eval(expression)

# Create and use the tool
calculator = CalculatorTool()
result = calculator.execute(expression="2 + 2 * 3")
print(result)  # 8.0

Creating an Async Tool

import asyncio
from minion_manus.tools import AsyncTool

class AsyncCalculatorTool(AsyncTool):
    name = "async_calculator"
    description = "Perform mathematical calculations asynchronously"
    inputs = {
        "expression": {
            "type": "string",
            "description": "Mathematical expression to evaluate",
            "required": True
        }
    }
    output_type = "number"
    
    async def _aexecute(self, expression: str) -> float:
        # Simulate async operation
        await asyncio.sleep(0.1)
        return eval(expression)

# Create and use the async tool
async def main():
    calculator = AsyncCalculatorTool()
    result = await calculator.aexecute(expression="2 + 2 * 3")
    print(result)  # 8.0

    asyncio.run(main())

Tool Schema Definition

Tools are defined with the following schema attributes:

  • name: A unique identifier for the tool
  • description: A detailed description of what the tool does
  • inputs: A dictionary defining the expected input parameters
  • output_type: The type of the expected output

Input parameters can have the following attributes:

  • type: Data type (string, number, boolean, object, array)
  • description: Description of the parameter
  • required: Whether the parameter is required
  • default: Default value if not provided

Adapters

Minion-Manus provides adapters to convert tools between different frameworks. Currently supported:

SmolaAgents Adapter

Convert between Minion-Manus tools and SmolaAgents tools:

from minion_manus.tools.adapters import AdapterFactory, AdapterType
from smolagents import DuckDuckGoSearchTool

# Convert Minion tool to SmolaAgents tool
calculator = CalculatorTool()
smola_calculator = AdapterFactory.get_adapter(AdapterType.SMOLAGENTS).to_external(calculator)

# Convert SmolaAgents tool to Minion tool
ddg_tool = DuckDuckGoSearchTool()
minion_ddg_tool = AdapterFactory.get_adapter(AdapterType.SMOLAGENTS).to_internal(ddg_tool)

Examples

The repository contains several examples demonstrating different aspects of Minion-Manus:

  • examples/smolagents_adapter_example.py: Demonstrates how to convert tools between Minion-Manus and SmolaAgents
  • examples/minion_provider_adapter.py: Shows how to use Minion LLM providers with SmolaAgents
  • examples/database_tool_example.py: Illustrates creating database tools using SQLAlchemy

Contributing

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

License

This project is licensed under the MIT License - 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

minion_manus-0.1.0.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

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

minion_manus-0.1.0-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for minion_manus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0c4444bbcd9834b280045d6aa87dcdc61bdffb1b5aba1499d92704e09ace0d3
MD5 ecddce73337d095fbb4095f4c74a0e61
BLAKE2b-256 b8522e90e9c9352b3dabd82967b8b7cffd2a30b301d3a595748490215d924fab

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for minion_manus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e27768d3375b0c396c613f89576a12975bb326b1a1b2bdd9e9ac111e37aec939
MD5 229086cde6b6788c27b3adfefc942fe0
BLAKE2b-256 67408571a4a2a1af3fdf9969300197e30ed9b529703f279da390eb562dfe5435

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