LangChain + Zapier Natural Language Actions (NLA)

LangChain + Zapier Natural Language Actions (NLA)

2 min read

We are super excited to team up with Zapier and integrate their new Zapier NLA API into LangChain, which you can now use with your agents and chains. With this integration, you have access to the 5k+ apps and 20k+ actions on Zapier's platform through a natural language API interface. This is extremely powerful and gives your LangChain agents seemingly limitless possibilities. Big shoutout to Mike Knoop and the rest of the Zapier team for helping with this integration. You can request access in the link shared above. What will you build?

Zapier NLA

NLA supports apps like Gmail, Salesforce, Trello, Slack, Asana, HubSpot, Google Sheets, Microsoft Teams, and thousands more apps: https://zapier.com/apps

Zapier NLA handles ALL the underlying API auth and translation from natural language -> underlying API call -> return simplified output for LLMs. The key idea is you expose a set of actions via an oauth-like setup window, which you can then query and execute via a REST API.

NLA offers both API Key and OAuth for signing NLA API requests.

  1. Server-side (API Key): for quickly getting started, testing, and production scenarios where LangChain will only use actions exposed in the developer's Zapier account (and will use the developer's connected accounts on Zapier.com)
  2. User-facing (Oauth): for production scenarios where you are deploying an end-user facing application and LangChain needs access to end-user's exposed actions and connected accounts on Zapier.com

Review full docs or reach out to nla@zapier.com for user-facing oauth developer support.

LangChain Integration

We've integrated Zapier NLA into a LangChain Tool and Toolkit in both Python (docs) and typescript (docs). This gives your agents and chains superpowers.

To use, simply retrieve an NLA API Key (see above), set the ZAPIER_NLA_API_KEY environment variable, then create a Toolkit and agent:

llm = OpenAI(temperature=0)
zapier = ZapierNLAWrapper()
toolkit = ZapierToolkit.from_zapier_nla_wrapper(zapier)
agent = initialize_agent(toolkit.get_tools(), llm, agent="zero-shot-react-description", verbose=True)

‌It's really that simple! The ZapierToolkit automatically registers all of your enabled Zapier actions as tools with the correct name and descriptions.

You can also register an individual action as a tool manually using the ZapierNLARunAction tool.

To see this in action, look at the example below. This agent now has access to my email and slack, and is able to do some amazing feats. In this example, it’s summarizing the latest email I received from a certain bank and sending it to a slack channel.

Next Steps

We’re hoping to make this as seamless an integration as possible so let us know if you have any feedback for hit any issues!