Using Connery Service in LangChain to Run Plugin Actions
Posted: Feb 1, 2025.
Connery is a powerful open-source plugin infrastructure for AI that allows you to integrate custom actions into your LangChain applications. In this guide, we'll explore how to use the ConneryService class to interact with the Connery Runner API.
What is ConneryService?
ConneryService is a class that provides an interface to interact with the Connery Runner API. It allows you to:
- Get a list of available plugin actions
- Retrieve specific actions by ID
- Execute actions with custom inputs
The service acts as a bridge between your LangChain application and Connery's plugin ecosystem, enabling you to leverage pre-built actions or custom plugins in your AI agents.
Reference
Here are the main methods provided by ConneryService:
Method | Description |
---|---|
list_actions() | Returns a list of all available actions from the Connery Runner |
get_action(action_id) | Retrieves a specific action by its ID |
run_action(action_id, input) | Executes an action with the given input parameters |
How to Use ConneryService
Setting Up ConneryService
First, you'll need to initialize ConneryService with your credentials:
Listing Available Actions
To get all available actions from your Connery Runner:
Getting a Specific Action
If you know the ID of an action you want to use:
Running Actions
You can run actions directly through the service:
Integration with LangChain Agents
ConneryService works particularly well with LangChain agents that support structured tools. Here's how to use it with an OpenAI Functions agent:
Using Multiple Actions
You can also use multiple actions together in a workflow:
Remember that Connery actions are structured tools, so they're best used with agents that support structured tool formats, like the OpenAI Functions agent.
An alternative to LangSmith
Open-source LangChain monitoring, prompt management, and magic. Get started in 2 minutes.
LangChain DocsJoin 10,000+ subscribers
Every 2 weeks, latest model releases and industry news.
An alternative to LangSmith
Open-source LangChain monitoring, prompt management, and magic. Get started in 2 minutes.