Skip to main content
Import agent from @novu/framework when you are not using @novu/framework/ai-sdk or @novu/framework/langchain. Call your LLM, orchestration library, or business logic yourself, then reply through Novu’s handler API. Use this path for Mastra, the OpenAI SDK, Anthropic SDK, or any stack Novu does not ship a dedicated adapter for. For a full walkthrough with Mastra, see the Mastra quickstart.

Before you start

Completed the Quickstart? Your agent, bridge, and project are already set up - jump to Minimal agent. Otherwise start with the Quickstart first. All three onboarding paths (dashboard, CLI, AI assistant) walk you through creating the agent and wiring the bridge. This page covers only what’s specific to wiring your own LLM stack.

Prerequisites

Install the framework package:
Bring your own LLM or agent library - Novu does not require a specific one.

Minimal agent

Import agent from @novu/framework, call your logic in onMessage, and reply by returning a string or calling ctx.reply():
Make sure the agent id ('support-bot') matches the Identifier in your dashboard, and that this handler is registered on your bridge route - see Connecting your app. For handlers, replies, signals, typing, and tool approval, see Building blocks. The sections below cover what’s specific to wiring your own LLM stack - return types and manual tool approval.

Returning from onMessage

On this path, onMessage accepts the standard reply types - not AI SDK results: Other handlers (onAction, onReaction, onResolve) accept string, Card, or nothing. Shorthand when you only need onMessage: pass the handler directly.

Tool approval

When a tool needs human approval, return ctx.toolApproval.request() from onMessage:
See Tool approval for the full API, card customization, and default behavior when you omit onToolApproval.

Mastra quickstart

Call Mastra generate() from a Novu handler.

AI SDK

Return AI SDK results from handlers with automatic tool approval resume.

LangChain

Return LangChain agent configs with automatic tool approval resume.

Typing indicator

Show a Thinking… or custom status while your handler runs.

Reply

Markdown, attachments, and interactive cards.

Tool approval

The shared Approve / Deny primitive.