!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)
        
    *   [Toolkits](/v0.2/docs/integrations/toolkits)
        
        *   [Connery Toolkit](/v0.2/docs/integrations/toolkits/connery)
        *   [JSON Agent Toolkit](/v0.2/docs/integrations/toolkits/json)
        *   [OpenAPI Agent Toolkit](/v0.2/docs/integrations/toolkits/openapi)
        *   [AWS Step Functions Toolkit](/v0.2/docs/integrations/toolkits/sfn_agent)
        *   [SQL Agent Toolkit](/v0.2/docs/integrations/toolkits/sql)
        *   [VectorStore Agent Toolkit](/v0.2/docs/integrations/toolkits/vectorstore)
    *   [Stores](/v0.2/docs/integrations/stores/)
        

*   [](/v0.2/)
*   [Components](/v0.2/docs/integrations/components)
*   [Toolkits](/v0.2/docs/integrations/toolkits)
*   Connery Toolkit

On this page

Connery Toolkit
===============

Using this toolkit, you can integrate Connery Actions into your LangChain agent.

note

If you want to use only one particular Connery Action in your agent, check out the [Connery Action Tool](/v0.2/docs/integrations/tools/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 Toolkit[​](#example-of-using-connery-toolkit "Direct link to Example of using Connery Toolkit")
------------------------------------------------------------------------------------------------------------------------

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

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

*   npm
*   Yarn
*   pnpm

    npm install @langchain/openai @langchain/community

    yarn add @langchain/openai @langchain/community

    pnpm add @langchain/openai @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 create an agent that uses two Connery Actions to summarize a public webpage and send the summary by email:

1.  **Summarize public webpage** action from the [Summarization](https://github.com/connery-io/summarization-plugin) plugin.
2.  **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/5485cb37-b73d-458f-8162-43639f2b49e1/r).

    import { ConneryService } from "@langchain/community/tools/connery";import { ConneryToolkit } from "@langchain/community/agents/toolkits/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";// Create a Connery Toolkit with all the available actions from the Connery Runner.const conneryService = new ConneryService();const conneryToolkit = await ConneryToolkit.createInstance(conneryService);// Use OpenAI Functions agent to execute the prompt using actions from the Connery Toolkit.const llm = new ChatOpenAI({ temperature: 0 });const agent = await initializeAgentExecutorWithOptions(  conneryToolkit.tools,  llm,  {    agentType: "openai-functions",    verbose: true,  });const result = await agent.invoke({  input:    `Make a short summary of the webpage http://www.paulgraham.com/vb.html in three sentences ` +    `and send it to ${recepientEmail}. Include the link to the webpage into the body of the email.`,});console.log(result.output);

#### API Reference:

*   [ConneryService](https://v02.api.js.langchain.com/classes/langchain_community_tools_connery.ConneryService.html) from `@langchain/community/tools/connery`
*   [ConneryToolkit](https://v02.api.js.langchain.com/classes/langchain_community_agents_toolkits_connery.ConneryToolkit.html) from `@langchain/community/agents/toolkits/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

Toolkits

](/v0.2/docs/integrations/toolkits)[

Next

JSON Agent Toolkit

](/v0.2/docs/integrations/toolkits/json)

*   [What is Connery?](#what-is-connery)
*   [Prerequisites](#prerequisites)
*   [Example of using Connery Toolkit](#example-of-using-connery-toolkit)
    *   [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.