From 12d7eaa0c25931af7414be5d8351da3302a9dfa0 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Tue, 17 Oct 2023 11:45:09 -0400 Subject: [PATCH] Add security notices to toolkits (#11900) This adds security notices to toolkits init, and to several toolkits. We'll need to continue documenting the rest of the toolkits. --------- Co-authored-by: Bagatur --- .../langchain/agents/agent_toolkits/__init__.py | 16 +++++++++++++++- .../agent_toolkits/file_management/toolkit.py | 2 ++ .../agents/agent_toolkits/github/toolkit.py | 12 +++++++++++- .../agents/agent_toolkits/gitlab/toolkit.py | 12 +++++++++++- .../agents/agent_toolkits/gmail/toolkit.py | 12 +++++++++++- .../agents/agent_toolkits/jira/toolkit.py | 9 ++++++++- 6 files changed, 58 insertions(+), 5 deletions(-) diff --git a/libs/langchain/langchain/agents/agent_toolkits/__init__.py b/libs/langchain/langchain/agents/agent_toolkits/__init__.py index 93532981e..537d5b6c2 100644 --- a/libs/langchain/langchain/agents/agent_toolkits/__init__.py +++ b/libs/langchain/langchain/agents/agent_toolkits/__init__.py @@ -1,4 +1,18 @@ -"""Agent toolkits.""" +"""Agent toolkits contain integrations with various resources and services. + +LangChain has a large ecosystem of integrations with various external resources +like local and remote file systems, APIs and databases. + +These integrations allow developers to create versatile applications that combine the +power of LLMs with the ability to access, interact with and manipulate external +resources. + +When developing an application, developers should inspect the capabilities and +permissions of the tools that underlie the given agent toolkit, and determine +whether permissions of the given toolkit are appropriate for the application. + +See [Security](https://python.langchain.com/docs/security) for more information. +""" from langchain.agents.agent_toolkits.ainetwork.toolkit import AINetworkToolkit from langchain.agents.agent_toolkits.amadeus.toolkit import AmadeusToolkit from langchain.agents.agent_toolkits.azure_cognitive_services import ( diff --git a/libs/langchain/langchain/agents/agent_toolkits/file_management/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/file_management/toolkit.py index 95615271d..6e4c59b49 100644 --- a/libs/langchain/langchain/agents/agent_toolkits/file_management/toolkit.py +++ b/libs/langchain/langchain/agents/agent_toolkits/file_management/toolkit.py @@ -47,6 +47,8 @@ class FileManagementToolkit(BaseToolkit): - Limit the tools available to the agent to only the file operations necessary for the agent's intended use. - Sandbox the agent by running it in a container. + + See https://python.langchain.com/docs/security for more information. """ root_dir: Optional[str] = None diff --git a/libs/langchain/langchain/agents/agent_toolkits/github/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/github/toolkit.py index 80cd78419..390866ac8 100644 --- a/libs/langchain/langchain/agents/agent_toolkits/github/toolkit.py +++ b/libs/langchain/langchain/agents/agent_toolkits/github/toolkit.py @@ -18,7 +18,17 @@ from langchain.utilities.github import GitHubAPIWrapper class GitHubToolkit(BaseToolkit): - """GitHub Toolkit.""" + """GitHub Toolkit. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by creating, deleting, or updating, + reading underlying data. + + For example, this toolkit can be used to create issues, pull requests, + and comments on GitHub. + + See [Security](https://python.langchain.com/docs/security) for more information. + """ tools: List[BaseTool] = [] diff --git a/libs/langchain/langchain/agents/agent_toolkits/gitlab/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/gitlab/toolkit.py index 87e83756c..1a2ac7265 100644 --- a/libs/langchain/langchain/agents/agent_toolkits/gitlab/toolkit.py +++ b/libs/langchain/langchain/agents/agent_toolkits/gitlab/toolkit.py @@ -18,7 +18,17 @@ from langchain.utilities.gitlab import GitLabAPIWrapper class GitLabToolkit(BaseToolkit): - """GitLab Toolkit.""" + """GitLab Toolkit. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by creating, deleting, or updating, + reading underlying data. + + For example, this toolkit can be used to create issues, pull requests, + and comments on GitLab. + + See https://python.langchain.com/docs/security for more information. + """ tools: List[BaseTool] = [] diff --git a/libs/langchain/langchain/agents/agent_toolkits/gmail/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/gmail/toolkit.py index cb456d6aa..34120cc28 100644 --- a/libs/langchain/langchain/agents/agent_toolkits/gmail/toolkit.py +++ b/libs/langchain/langchain/agents/agent_toolkits/gmail/toolkit.py @@ -27,7 +27,17 @@ SCOPES = ["https://mail.google.com/"] class GmailToolkit(BaseToolkit): - """Toolkit for interacting with Gmail.""" + """Toolkit for interacting with Gmail. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by reading, creating, updating, deleting + data associated with this service. + + For example, this toolkit can be used to send emails on behalf of the + associated account. + + See https://python.langchain.com/docs/security for more information. + """ api_resource: Resource = Field(default_factory=build_resource_service) diff --git a/libs/langchain/langchain/agents/agent_toolkits/jira/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/jira/toolkit.py index cba3fd336..1e6c350b1 100644 --- a/libs/langchain/langchain/agents/agent_toolkits/jira/toolkit.py +++ b/libs/langchain/langchain/agents/agent_toolkits/jira/toolkit.py @@ -14,7 +14,14 @@ from langchain.utilities.jira import JiraAPIWrapper class JiraToolkit(BaseToolkit): - """Jira Toolkit.""" + """Jira Toolkit. + + *Security Note*: This toolkit contains tools that can read and modify + the state of a service; e.g., by creating, deleting, or updating, + reading underlying data. + + See https://python.langchain.com/docs/security for more information. + """ tools: List[BaseTool] = []