!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)

You are viewing the **preview** v0.2 docs. View the **stable** v0.1 docs [here](/v0.1/docs/get_started/introduction/). Leave feedback on the v0.2 docs [here](https://github.com/langchain-ai/langchainjs/discussions/5386).

[

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

](/v0.2/)[Integrations](/v0.2/docs/integrations/platforms/)[API Reference](https://v02.api.js.langchain.com)

[More](#)

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

[v0.2](#)

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

*   [](/v0.2/)
*   [Components](/v0.2/docs/integrations/components)
*   [Tools](/v0.2/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.2/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.2/docs/how_to/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://v02.api.js.langchain.com/classes/langchain_community_tools_connery.ConneryService.html) from `@langchain/community/tools/connery`
*   [ChatOpenAI](https://v02.api.js.langchain.com/classes/langchain_openai.ChatOpenAI.html) from `@langchain/openai`
*   [initializeAgentExecutorWithOptions](https://v02.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.

* * *

#### Was this page helpful?

  

#### You can leave detailed feedback [on GitHub](https://github.com/langchain-ai/langchainjs/issues/new?assignees=&labels=03+-+Documentation&projects=&template=documentation.yml&title=DOC%3A+%3CPlease+write+a+comprehensive+title+after+the+%27DOC%3A+%27+prefix%3E).

[

Previous

ChatGPT Plugins

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

Next

Dall-E Tool

](/v0.2/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.