Skip to content

Using codebase as tools #3

@anilaltuner

Description

@anilaltuner

Add capability to define and integrate custom tools using Python classes

Implement a feature that allows users to create custom tools as Python classes and seamlessly integrate them into the workflow system. This will enhance flexibility and use cases on Dria Workflows

Example:

class CustomMathTool(Tool):
    name = "CustomMathTool"
    description = "Performs custom mathematical operations"

    def process(self, x: float, y: float, operation: str) -> float:
        if operation == "add":
            return x + y
        elif operation == "multiply":
            return x * y
        else:
            raise ValueError("Unsupported operation")

# Register the custom tool
register_tool(CustomMathTool)

# Use in workflow
builder.step(
    id="math_operation",
    tool="CustomMathTool",
    inputs={"x": 5, "y": 3, "operation": "multiply"}
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions