17 lines
574 B
Python
17 lines
574 B
Python
from cleveragents.agents.tool import Tool
|
|
from cleveragents.core.exceptions import ExecutionError
|
|
|
|
|
|
class CustomToolTool(Tool):
|
|
"""Custom tool implementation for testing."""
|
|
|
|
def __init__(self, config=None):
|
|
super().__init__("custom_tool", "A custom tool for testing", config or {})
|
|
|
|
async def execute(self, input_data, context=None):
|
|
if context is None:
|
|
context = {}
|
|
if "fail" in input_data.lower():
|
|
raise ExecutionError("Tool execution failed as requested")
|
|
return f"Custom tool processed: {input_data}"
|