Agent Toolkit
Expose Novu notification workflows as tools for LLM agents with the @novu/agent-toolkit package. Works with OpenAI, LangChain, and Vercel AI SDK.
What is the Agent Toolkit?
The @novu/agent-toolkit package lets you expose Novu notification workflows as tools for LLM agents. It works with OpenAI, LangChain, and Vercel AI SDK.
The toolkit automatically discovers your Novu workflows and converts them into strongly-typed tools that an LLM can invoke, letting your AI agent send notifications, manage subscriber preferences, and trigger any workflow you've built in Novu.
The Agent Toolkit is a code-level SDK for embedding Novu tools inside your own AI agents. For giving AI coding assistants (Claude Code, Cursor, Copilot) context about Novu, see Agent Skills. For connecting AI tools to Novu via the Model Context Protocol, see MCP.
Installation
Then install the peer dependency for the AI framework you use:
| Framework | Peer Dependency | Import Path |
|---|---|---|
| OpenAI | openai >= 4.0.0 | @novu/agent-toolkit/openai |
| LangChain | @langchain/core >= 0.2.0 | @novu/agent-toolkit/langchain |
| Vercel AI SDK | ai >= 6.0.0 | @novu/agent-toolkit/ai-sdk |
Quick Start
Configuration
Every adapter's createNovuAgentToolkit accepts a NovuToolkitConfig object:
| Option | Required | Description |
|---|---|---|
secretKey | Yes | Your Novu API secret key from dashboard.novu.co/settings/api-keys. |
subscriberId | Yes | Default subscriber ID used when triggering workflows. |
backendUrl | No | Custom Novu API URL (defaults to Novu Cloud). |
workflows.tags | No | Filter discovered workflows by tags. |
workflows.workflowIds | No | Restrict discovered workflows to specific IDs. |
Framework Adapters
Each adapter exposes a createNovuAgentToolkit function that returns tools in the native format for that framework.
OpenAI
The returned toolkit provides:
tools— Array of OpenAI-compatible function tool definitions.handleToolCall(toolCall)— Executes a tool call and returns a{ role: 'tool', tool_call_id, content }message ready to append to the conversation.
Full example with tool-call loop:
LangChain
The returned toolkit provides:
tools— Array ofDynamicStructuredToolinstances that can be passed directly to LangChain agents or executors.
Example with a LangChain agent:
Vercel AI SDK
The returned toolkit provides:
tools— AToolSetobject that can be passed togenerateText,streamText, or other Vercel AI SDK functions.
Example with generateText:
Built-in Tools
The toolkit ships with two built-in tools that are always available regardless of which workflows you have configured.
trigger_workflow
Triggers any Novu workflow by its identifier. Use this as a generic entry point to send notifications.
| Parameter | Type | Required | Description |
|---|---|---|---|
workflowId | string | Yes | The workflow identifier to trigger. |
payload | Record<string, unknown> | No | Data passed to the workflow for rendering notification content. |
overrides | Record<string, unknown> | No | Provider-specific configuration overrides. |
subscriberId | string | No | Target subscriber (defaults to configured subscriberId). |
transactionId | string | No | Unique key for deduplication. |
update_preferences
Updates notification channel preferences for a subscriber, either globally or for a specific workflow.
| Parameter | Type | Required | Description |
|---|---|---|---|
workflowId | string | No | Scope to a specific workflow. Omit for global preferences. |
channels | object | No | Channel toggles: email, sms, push, inApp, chat. |
subscriberId | string | No | Target subscriber (defaults to configured subscriberId). |
Dynamic Workflow Tools
On initialization the toolkit fetches your Novu workflows and creates a dedicated tool for each one. These tools are named trigger_<workflow_id> (with hyphens replaced by underscores) and include the workflow's payload schema so the LLM knows exactly what data to provide.
Filter which workflows are exposed using the workflows config option:
For example, if you have a workflow with ID welcome-email, the toolkit generates a trigger_welcome_email tool whose parameter schema matches the workflow's payloadSchema. The LLM sees a purpose-built tool instead of a generic trigger, which improves accuracy and reduces prompt engineering.
Use Cases
- Customer support agents — Let an AI agent send order confirmations, shipping updates, or support ticket notifications through Novu workflows.
- Internal tooling — Build Slack bots or internal agents that trigger team notifications, incident alerts, or onboarding workflows.
- Preference management — Allow users to manage their notification preferences through a conversational AI interface.
- Multi-channel broadcasting — Enable agents to send coordinated notifications across email, SMS, push, in-app, and chat from a single tool call.
Source Code
The @novu/agent-toolkit package is part of the Novu monorepo on the next branch.
Package Structure
Available Exports
| Import Path | Description |
|---|---|
@novu/agent-toolkit | Core NovuToolkit class, NovuTool factory, and types. |
@novu/agent-toolkit/openai | OpenAI adapter with createNovuAgentToolkit. |
@novu/agent-toolkit/langchain | LangChain adapter with createNovuAgentToolkit. |
@novu/agent-toolkit/ai-sdk | Vercel AI SDK adapter with createNovuAgentToolkit. |
@novu/agent-toolkit/core | Core classes and types (for building custom adapters). |