!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}(),document.documentElement.setAttribute("data-announcement-bar-initially-dismissed",function(){try{return"true"===localStorage.getItem("docusaurus.announcement.dismiss")}catch(t){}return!1}())

[Skip to main content](#__docusaurus_skipToContent_fallback)

LangChain v0.2 is coming soon! Preview the new docs [here](/v0.2/docs/introduction/).

[

![🦜️🔗 Langchain](/v0.1/img/brand/wordmark.png)![🦜️🔗 Langchain](/v0.1/img/brand/wordmark-dark.png)

](/v0.1/)[Docs](/v0.1/docs/get_started/introduction/)[Use cases](/v0.1/docs/use_cases/)[Integrations](/v0.1/docs/integrations/platforms/)[API Reference](https://api.js.langchain.com)

[More](#)

*   [People](/v0.1/docs/people/)
*   [Community](/v0.1/docs/community/)
*   [Tutorials](/v0.1/docs/additional_resources/tutorials/)
*   [Contributing](/v0.1/docs/contributing/)

[v0.1](#)

*   [v0.2](https://js.langchain.com/v0.2/docs/introduction)
*   [v0.1](/v0.1/docs/get_started/introduction/)

[🦜🔗](#)

*   [LangSmith](https://smith.langchain.com)
*   [LangSmith Docs](https://docs.smith.langchain.com)
*   [LangChain Hub](https://smith.langchain.com/hub)
*   [LangServe](https://github.com/langchain-ai/langserve)
*   [Python Docs](https://python.langchain.com/)

[Chat](https://chatjs.langchain.com)[](https://github.com/langchain-ai/langchainjs)

Search

*   [Providers](/v0.1/docs/integrations/platforms/)
    
    *   [Providers](/v0.1/docs/integrations/platforms/)
    *   [Anthropic](/v0.1/docs/integrations/platforms/anthropic/)
    *   [AWS](/v0.1/docs/integrations/platforms/aws/)
    *   [Google](/v0.1/docs/integrations/platforms/google/)
    *   [Microsoft](/v0.1/docs/integrations/platforms/microsoft/)
    *   [OpenAI](/v0.1/docs/integrations/platforms/openai/)
*   [Components](/v0.1/docs/integrations/components/)
    
    *   [LLMs](/v0.1/docs/integrations/llms/)
        
    *   [Chat models](/v0.1/docs/integrations/chat/)
        
    *   [Document loaders](/v0.1/docs/integrations/document_loaders/)
        
    *   [Document transformers](/v0.1/docs/integrations/document_transformers/)
        
    *   [Document compressors](/v0.1/docs/integrations/document_compressors/)
        
    *   [Text embedding models](/v0.1/docs/integrations/text_embedding/)
        
    *   [Vector stores](/v0.1/docs/integrations/vectorstores/)
        
    *   [Retrievers](/v0.1/docs/integrations/retrievers/)
        
    *   [Tools](/v0.1/docs/integrations/tools/)
        
        *   [ChatGPT Plugins](/v0.1/docs/integrations/tools/aiplugin-tool/)
        *   [Connery Action Tool](/v0.1/docs/integrations/tools/connery/)
        *   [Dall-E Tool](/v0.1/docs/integrations/tools/dalle/)
        *   [Discord Tool](/v0.1/docs/integrations/tools/discord/)
        *   [DuckDuckGoSearch](/v0.1/docs/integrations/tools/duckduckgo_search/)
        *   [Exa Search](/v0.1/docs/integrations/tools/exa_search/)
        *   [Gmail Tool](/v0.1/docs/integrations/tools/gmail/)
        *   [Google Calendar Tool](/v0.1/docs/integrations/tools/google_calendar/)
        *   [Google Places Tool](/v0.1/docs/integrations/tools/google_places/)
        *   [Agent with AWS Lambda](/v0.1/docs/integrations/tools/lambda_agent/)
        *   [Python interpreter tool](/v0.1/docs/integrations/tools/pyinterpreter/)
        *   [SearchApi tool](/v0.1/docs/integrations/tools/searchapi/)
        *   [Searxng Search tool](/v0.1/docs/integrations/tools/searxng/)
        *   [StackExchange Tool](/v0.1/docs/integrations/tools/stackexchange/)
        *   [Tavily Search](/v0.1/docs/integrations/tools/tavily_search/)
        *   [Web Browser Tool](/v0.1/docs/integrations/tools/webbrowser/)
        *   [Wikipedia tool](/v0.1/docs/integrations/tools/wikipedia/)
        *   [WolframAlpha Tool](/v0.1/docs/integrations/tools/wolframalpha/)
        *   [Agent with Zapier NLA Integration](/v0.1/docs/integrations/tools/zapier_agent/)
    *   [Agents and toolkits](/v0.1/docs/integrations/toolkits/)
        
    *   [Chat Memory](/v0.1/docs/integrations/chat_memory/)
        
    *   [Stores](/v0.1/docs/integrations/stores/)
        

*   [](/v0.1/)
*   [Components](/v0.1/docs/integrations/components/)
*   [Tools](/v0.1/docs/integrations/tools/)
*   Connery Action Tool

On this page

Connery Action Tool
===================

Using this tool, you can integrate individual Connery Action into your LangChain agent.

note

If you want to use more than one Connery Action in your agent, check out the [Connery Toolkit](/v0.1/docs/integrations/toolkits/connery/) documentation.

What is Connery?[​](#what-is-connery "Direct link to What is Connery?")
-----------------------------------------------------------------------

Connery is an open-source plugin infrastructure for AI.

With Connery, you can easily create a custom plugin with a set of actions and seamlessly integrate them into your LangChain agent. Connery will take care of critical aspects such as runtime, authorization, secret management, access management, audit logs, and other vital features.

Furthermore, Connery, supported by our community, provides a diverse collection of ready-to-use open-source plugins for added convenience.

Learn more about Connery:

*   GitHub: [https://github.com/connery-io/connery](https://github.com/connery-io/connery)
*   Documentation: [https://docs.connery.io](https://docs.connery.io)

Prerequisites[​](#prerequisites "Direct link to Prerequisites")
---------------------------------------------------------------

To use Connery Actions in your LangChain agent, you need to do some preparation:

1.  Set up the Connery runner using the [Quickstart](https://docs.connery.io/docs/runner/quick-start/) guide.
2.  Install all the plugins with the actions you want to use in your agent.
3.  Set environment variables `CONNERY_RUNNER_URL` and `CONNERY_RUNNER_API_KEY` so the toolkit can communicate with the Connery Runner.

Example of using Connery Action Tool[​](#example-of-using-connery-action-tool "Direct link to Example of using Connery Action Tool")
------------------------------------------------------------------------------------------------------------------------------------

### Setup[​](#setup "Direct link to Setup")

To use the Connery Action Tool you need to install the following official peer dependency:

*   npm
*   Yarn
*   pnpm

    npm install @langchain/community

    yarn add @langchain/community

    pnpm add @langchain/community

tip

See [this section for general instructions on installing integration packages](/v0.1/docs/get_started/installation/#installing-integration-packages).

### Usage[​](#usage "Direct link to Usage")

In the example below, we fetch action by its ID from the Connery Runner and then call it with the specified parameters.

Here, we use the ID of the **Send email** action from the [Gmail](https://github.com/connery-io/gmail) plugin.

info

You can see a LangSmith trace of this example [here](https://smith.langchain.com/public/c4b6723d-f91c-440c-8682-16ec8297a602/r).

    import { ConneryService } from "@langchain/community/tools/connery";import { ChatOpenAI } from "@langchain/openai";import { initializeAgentExecutorWithOptions } from "langchain/agents";// Specify your Connery Runner credentials.process.env.CONNERY_RUNNER_URL = "";process.env.CONNERY_RUNNER_API_KEY = "";// Specify OpenAI API key.process.env.OPENAI_API_KEY = "";// Specify your email address to receive the emails from examples below.const recepientEmail = "test@example.com";// Get the SendEmail action from the Connery Runner by ID.const conneryService = new ConneryService();const sendEmailAction = await conneryService.getAction(  "CABC80BB79C15067CA983495324AE709");// Run the action manually.const manualRunResult = await sendEmailAction.invoke({  recipient: recepientEmail,  subject: "Test email",  body: "This is a test email sent by Connery.",});console.log(manualRunResult);// Run the action using the OpenAI Functions agent.const llm = new ChatOpenAI({ temperature: 0 });const agent = await initializeAgentExecutorWithOptions([sendEmailAction], llm, {  agentType: "openai-functions",  verbose: true,});const agentRunResult = await agent.invoke({  input: `Send an email to the ${recepientEmail} and say that I will be late for the meeting.`,});console.log(agentRunResult);

#### API Reference:

*   [ConneryService](https://api.js.langchain.com/classes/langchain_community_tools_connery.ConneryService.html) from `@langchain/community/tools/connery`
*   [ChatOpenAI](https://api.js.langchain.com/classes/langchain_openai.ChatOpenAI.html) from `@langchain/openai`
*   [initializeAgentExecutorWithOptions](https://api.js.langchain.com/functions/langchain_agents.initializeAgentExecutorWithOptions.html) from `langchain/agents`

note

Connery Action is a structured tool, so you can only use it in the agents supporting structured tools.

* * *

#### Help us out by providing feedback on this documentation page:

[

Previous

ChatGPT Plugins

](/v0.1/docs/integrations/tools/aiplugin-tool/)[

Next

Dall-E Tool

](/v0.1/docs/integrations/tools/dalle/)

*   [What is Connery?](#what-is-connery)
*   [Prerequisites](#prerequisites)
*   [Example of using Connery Action Tool](#example-of-using-connery-action-tool)
    *   [Setup](#setup)
    *   [Usage](#usage)

Community

*   [Discord](https://discord.gg/cU2adEyC7w)
*   [Twitter](https://twitter.com/LangChainAI)

GitHub

*   [Python](https://github.com/langchain-ai/langchain)
*   [JS/TS](https://github.com/langchain-ai/langchainjs)

More

*   [Homepage](https://langchain.com)
*   [Blog](https://blog.langchain.dev)

Copyright © 2024 LangChain, Inc.