Table of Contents
Module spoon_ai.agents.custom_agent
CustomAgent Objects​
class CustomAgent(ToolCallAgent)
Custom Agent class allowing users to create their own agents and add custom tools
Usage: Create custom agent and add tools: agent = CustomAgent(name="my_agent", description="My custom agent") agent.add_tool(MyCustomTool()) result = await agent.run("Use my custom tool")
add_tool​
def add_tool(tool: BaseTool) -> None
Add a tool to the agent with validation.
Arguments:
tool- Tool instance to add
Raises:
ValueError- If tool is invalid or already exists
add_tools​
def add_tools(tools: List[BaseTool]) -> None
Add multiple tools to the agent with atomic operation.
Arguments:
tools- List of tool instances to add
Raises:
ValueError- If any tool is invalid
remove_tool​
def remove_tool(tool_name: str) -> bool
Remove a tool from the agent.
Arguments:
tool_name- Name of the tool to remove
Returns:
bool- True if tool was removed, False if not found
list_tools​
def list_tools() -> List[str]
List all available tools in the agent.
Returns:
List of tool names, empty list if no tools
get_tool_info​
def get_tool_info() -> Dict[str, Dict[str, Any]]
Get detailed information about all tools.
Returns:
Dictionary with tool names as keys and tool info as values
validate_tools​
def validate_tools() -> Dict[str, Any]
Validate all current tools and return validation report.
Returns:
Dictionary with validation results
run​
async def run(request: Optional[str] = None) -> str
Run the agent with enhanced tool validation.
Arguments:
request- User request
Returns:
Processing result
clear​
def clear()
Enhanced clear method with proper tool state management.