dragon.ai.agent.tools.base.BaseTool

class BaseTool[source]

Bases: ABC

Base class for all tools available to Dragon agents.

Subclasses must set name and description as class-level attributes (or properties) and implement run().

Example

class WebSearch(BaseTool):
    name = "web_search"
    description = "Search the web and return top results."

    def run(self, input: dict) -> dict:
        query = input["query"]
        ...
        return {"results": [...]}
__init__()

Methods

__init__()

run(input)

Execute the tool with the given input and return a result dict.

to_schema()

Return an OpenAI-compatible tool/function schema.

Attributes

name

description

name: str
description: str
abstractmethod run(input: dict [str , Any ]) dict [str , Any ][source]

Execute the tool with the given input and return a result dict.

to_schema() dict [str , Any ][source]

Return an OpenAI-compatible tool/function schema.

Override this method to provide detailed parameter schemas. The default implementation returns a minimal schema derived from name and description.