Skip to content

The agent engineering platform.

community[patch],core[minor]: Move BaseToolKit to core.tools (#20669)

Eugene Yurtsev38adbfdf3406
diff --git a/libs/community/langchain_community/agent_toolkits/base.py b/libs/community/langchain_community/agent_toolkits/base.py
index 0315184115..0776de523b 100644
--- a/libs/community/langchain_community/agent_toolkits/base.py
+++ b/libs/community/langchain_community/agent_toolkits/base.py
@@ -1,15 +1,4 @@
"""Toolkits for agents."""
-from abc import ABC, abstractmethod
-from typing import List
+from langchain_core.tools import BaseToolkit
-from langchain_core.pydantic_v1 import BaseModel
-
-from langchain_community.tools import BaseTool
-
-
-class BaseToolkit(BaseModel, ABC):
- """Base Toolkit representing a collection of related tools."""
-
- @abstractmethod
- def get_tools(self) -> List[BaseTool]:
- """Get the tools in the toolkit."""
+__all__ = ["BaseToolkit"]
diff --git a/libs/core/langchain_core/tools.py b/libs/core/langchain_core/tools.py
index d7abd121cb..363d12b950 100644
--- a/libs/core/langchain_core/tools.py
+++ b/libs/core/langchain_core/tools.py
@@ -22,7 +22,7 @@ from __future__ import annotations
import inspect
import uuid
import warnings
-from abc import abstractmethod
+from abc import ABC, abstractmethod
from functools import partial
from inspect import signature
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Type, Union
@@ -1038,3 +1038,11 @@ args: {"expression": {"type": "string"}}
args_schema = str(tool.args)
tool_strings.append(f"{tool.name}: {tool.description}, args: {args_schema}")
return "\n".join(tool_strings)
+
+
+class BaseToolkit(BaseModel, ABC):
+ """Base Toolkit representing a collection of related tools."""
+
+ @abstractmethod
+ def get_tools(self) -> List[BaseTool]:
+ """Get the tools in the toolkit."""