Files
agent-maxim/agent/runtime/tool_registry.py
T
Anton 052591281d Initial clean version - Agent Maxim
- Complete agent system with planning and execution
- Bridge API with FastAPI server
- WhatsApp-style mobile dashboard
- Enhanced web search with query improvement
- Security guards and policy checks
- Comprehensive documentation
2026-04-09 18:07:43 +03:00

33 lines
1.0 KiB
Python

"""Registry mapping step kinds to handler functions."""
from __future__ import annotations
from typing import Callable, Optional
from core.state import PlanStep, StepResult
from runtime.tools.file_ops import finish_step, read_file, write_file
from runtime.tools.flaky import run_flaky
from runtime.tools.shell import run_shell
from runtime.tools.web_fetch import web_fetch
from runtime.tools.web_search import web_search
ToolHandler = Callable[[PlanStep], StepResult]
class ToolRegistry:
"""Maps step kind strings to callable tool handlers."""
def __init__(self) -> None:
self._handlers: dict[str, ToolHandler] = {
"shell": run_shell,
"write_file": write_file,
"read_file": read_file,
"finish": finish_step,
"flaky": run_flaky,
"web_search": web_search,
"web_fetch": web_fetch,
}
def get(self, kind: str) -> Optional[ToolHandler]:
"""Return handler for the given kind, or None if unknown."""
return self._handlers.get(kind)