diff --git a/content/docs/agents/get-started/core-concepts.mdx b/content/docs/agents/get-started/core-concepts.mdx index 4780e7397..7e1ec616c 100644 --- a/content/docs/agents/get-started/core-concepts.mdx +++ b/content/docs/agents/get-started/core-concepts.mdx @@ -162,23 +162,24 @@ Now that you understand the core concepts, continue with: } - href="/agents/getting-started/quickstart" + href="/agents/get-started/quickstart" title="Quickstart" > Create your first agent, connect a provider, and send a message. - } - href="/agents/agent-bridge/agent-definition" - title="Agent bridge" + href="/agents/setup-your-agent/agent-logic" + title="Agent logic" > - Deep dive into defining agents, event handlers, context, replies, and signals.Create your first agent, connect a provider, and send a message. + Build your agent logic. } - href="/agents/agent-logic/overview" - title="Agent logic" + href="/agents/manage-agents/manage-conversations" + title="Agent bridge" > - Connect your preferred framework or runtime. + Manage your agent conversations. + \ No newline at end of file diff --git a/content/docs/agents/get-started/quickstart.mdx b/content/docs/agents/get-started/quickstart.mdx index 871b6703f..5f78f7aca 100644 --- a/content/docs/agents/get-started/quickstart.mdx +++ b/content/docs/agents/get-started/quickstart.mdx @@ -137,7 +137,7 @@ Open the Slack channel where your app is installed and send a message to your bo ![Slack message](/images/agents/quickstart/slack-message.png) -Edit the files in `app/novu/agents/` to customize how your agent responds. See [Handle Events](/agents/setup-your-agent/connect-your-code/handle-events) for the full list of events your agent can respond to. +Edit the files in `app/novu/agents/` to customize how your agent responds. See [Handle Events](/agents/setup-your-agent/handle-events) for the full list of events your agent can respond to. ## Next steps diff --git a/content/docs/agents/get-started/what-is-aci.mdx b/content/docs/agents/get-started/what-is-aci.mdx index 35901a320..33c455aa8 100644 --- a/content/docs/agents/get-started/what-is-aci.mdx +++ b/content/docs/agents/get-started/what-is-aci.mdx @@ -93,27 +93,18 @@ Common use cases include: } + > + Learn more about the core concepts of Novu Agents. + + } > - Create your first agent and connect it to Slack in under 10 minutes. - - } title="Connect your providers">Learn how to connect any provider of your choice. - } href="/" title="Connect your code"> - Learn how to connect your to the Novu - - } href="/" title="Add agent logic"> - Learn how to connect your agent brain to the agent communication layer + Create your first agent, connect a slack provider, and send a message in under 5 minutes. -## Learn more - - - } href="/" title="Understand concepts"> - Learn more about the core concepts of Novu Agents. - - - - diff --git a/content/docs/agents/index.mdx b/content/docs/agents/index.mdx deleted file mode 100644 index 81f240627..000000000 --- a/content/docs/agents/index.mdx +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Overview" -pageTitle: 'Novu Agents Overview' -description: 'Explore Novu Agents: conversational agents built on Novu.' ---- \ No newline at end of file diff --git a/content/docs/agents/deploy-your-agent.mdx b/content/docs/agents/manage-agents/deploy-your-agent.mdx similarity index 99% rename from content/docs/agents/deploy-your-agent.mdx rename to content/docs/agents/manage-agents/deploy-your-agent.mdx index 1792f422d..97cc74156 100644 --- a/content/docs/agents/deploy-your-agent.mdx +++ b/content/docs/agents/manage-agents/deploy-your-agent.mdx @@ -2,6 +2,7 @@ title: "Agent Deployment" pageTitle: 'Agent Deployment' description: 'Learn how to run a conversational agent on your local machine, test it in a development environment, and deploy it to production.' +icon: Rocket --- Agents built with Novu can run on your local machine. Deploy them to development and production environments when you are ready. diff --git a/content/docs/agents/manage-conversations.mdx b/content/docs/agents/manage-agents/manage-conversations.mdx similarity index 98% rename from content/docs/agents/manage-conversations.mdx rename to content/docs/agents/manage-agents/manage-conversations.mdx index fa5682dc1..fa9954ec1 100644 --- a/content/docs/agents/manage-conversations.mdx +++ b/content/docs/agents/manage-agents/manage-conversations.mdx @@ -1,7 +1,8 @@ --- -title: "Agent conversations" +title: "Agent Conversations" pageTitle: 'Manage agents conversations' description: 'How to manage agent conversations, their history, lifecycle and observability.' +icon: MessagesSquare --- Novu provides full observability for agent conversations. You can view and manage conversations in the Novu dashboard. To access the conversations, go to the Activity Feed page on the dashboard and switch to the Agent Conversations tab. diff --git a/content/docs/agents/meta.json b/content/docs/agents/meta.json index 277efd266..a468cd955 100644 --- a/content/docs/agents/meta.json +++ b/content/docs/agents/meta.json @@ -7,10 +7,17 @@ "get-started/what-is-aci", "get-started/core-concepts", "get-started/quickstart", - "setup-your-agent", - "manage-conversations", - "deploy-your-agent", - "add-connect-components", - "receive-inbound-email" + + "---Setup Your Agent---", + "setup-your-agent/overview", + "setup-your-agent/agent-logic", + "setup-your-agent/handle-events", + "setup-your-agent/reply-types", + "setup-your-agent/use-signals", + "setup-your-agent/add-connect-components", + + "---Manage Agents---", + "manage-agents/manage-conversations", + "manage-agents/deploy-your-agent" ] } diff --git a/content/docs/agents/add-connect-components.mdx b/content/docs/agents/setup-your-agent/add-connect-components.mdx similarity index 97% rename from content/docs/agents/add-connect-components.mdx rename to content/docs/agents/setup-your-agent/add-connect-components.mdx index 90404af4f..242cb8578 100644 --- a/content/docs/agents/add-connect-components.mdx +++ b/content/docs/agents/setup-your-agent/add-connect-components.mdx @@ -1,7 +1,8 @@ --- -title: "Add Connect Components" -pageTitle: 'Novu Agents Add Connect Components' +title: "Connect Components" +pageTitle: 'Novu Agents Connect Components' description: 'Add Connect UI components so users can link accounts and channels to your agent.' +icon: Puzzle --- Novu provides pre-built UI components for chat platforms like Slack and Microsoft Teams. Add these components so users can install the Slack or Microsoft Teams app in their workspace and connect it to your agent. diff --git a/content/docs/agents/add-connect-components.model.mdx b/content/docs/agents/setup-your-agent/add-connect-components.model.mdx similarity index 91% rename from content/docs/agents/add-connect-components.model.mdx rename to content/docs/agents/setup-your-agent/add-connect-components.model.mdx index 9f568e5b7..42087d495 100644 --- a/content/docs/agents/add-connect-components.model.mdx +++ b/content/docs/agents/setup-your-agent/add-connect-components.model.mdx @@ -1,7 +1,8 @@ --- -title: "Add Connect Components" -pageTitle: 'Novu Agents Add Connect Components' +title: "Connect Components" +pageTitle: 'Novu Agents Connect Components' description: 'Add Connect UI components so users can link accounts and channels to your agent.' +icon: Puzzle --- Novu provides pre-built UI components for chat platforms like Slack and Microsoft Teams. Add these components so users can install the Slack or Microsoft Teams app in their workspace and connect it to your agent. @@ -48,7 +49,7 @@ export default SlackConnectButtonComponent; `SlackConnectButton` accepts the following props to customize the UI and behavior: ---type-table--- -../platform/sdks/types/react-types.ts#SlackConnectButtonProps +../../platform/sdks/types/react-types.ts#SlackConnectButtonProps ---end--- ## Microsoft Teams connect button diff --git a/content/docs/agents/setup-your-agent/agent-logic.mdx b/content/docs/agents/setup-your-agent/agent-logic.mdx new file mode 100644 index 000000000..fa0faae3f --- /dev/null +++ b/content/docs/agents/setup-your-agent/agent-logic.mdx @@ -0,0 +1,331 @@ +--- +title: "Agent Logic" +pageTitle: 'Novu Agents Logic' +description: 'Write your agents lo' +icon: Brain +--- + +import { Steps, Step } from 'fumadocs-ui/components/steps'; +import { Brain, ThumbsUp, Mail, LayoutGrid, Rocket } from 'lucide-react'; + +Once you've scaffolded an agent, the next question is usually: *what do I actually put in this file?* + +This page builds one agent from scratch, a small support bot for a fictional log monitoring product called Pipelinr. You'll add one piece at a time, and by the end you'll have a single file that greets users, routes them by topic, replies to follow-ups, and resolves the thread when they're done. + +If you want the API reference for any of the pieces below, see [Handle Events](/agents/setup-your-agent/handle-events), [Reply Types](/agents/setup-your-agent/reply-types), and [Signals](/agents/setup-your-agent/use-signals). + +## What we're building + +Pipelinr customers usually contact support for one of three reasons: + +- a **billing** question (invoices, seats, usage spikes) +- a **technical** issue (broken pipelines, missing logs, API errors) +- something else (account access, feature requests) + +So the agent's job is simple: say hi, ask which bucket the issue falls in, answer the follow-up, and close the conversation when the user says "thanks". That's enough to be useful in production, and it covers every event type the framework gives you. + +## Where the code goes + +The scaffold drops a Next.js app with this shape: + +```text +app/ + api/novu/route.ts # exposes your agents over HTTP + novu/ + agents/ + index.ts # re-exports each agent + support-agent.tsx # the file we'll edit +``` + +You almost never touch `route.ts` after the first day. It just wires your agent into Novu: + +```ts title="app/api/novu/route.ts" +import { serve } from '@novu/framework/next'; +import { supportAgent } from '../../novu/agents'; + +export const { GET, POST, OPTIONS } = serve({ + agents: [supportAgent], +}); +``` + +Everything below happens inside `support-agent.tsx`. + +## Building agents Logic + + + + +### Step 1: Define the agent shell + +Start with the bare minimum, an `agent()` call with an id and an empty `onMessage` handler. The id (`support-agent`) is what you'll reference in the Novu dashboard. + +```tsx title="app/novu/agents/support-agent.tsx" +/** @jsxImportSource @novu/framework */ +import { agent } from '@novu/framework'; + +export const supportAgent = agent('support-agent', { + onMessage: async ({ message, ctx }) => { + return `You said: ${message.text}`; + }, +}); +``` + +The JSX pragma at the top lets us return cards as JSX later. You can skip it if you only ever return strings. + +At this point the agent is already alive: send it a message and it echoes back. Now let's make it actually behave like a support bot. + + + + +### Handle first message + +A real support bot doesn't open with "you said: hello". It introduces itself and asks how it can help. + +The `ctx.conversation.messageCount` field tells you which turn you're on. On the first message it's `1`, so we can branch on that and send a welcome card with three buttons, one for each topic. + +```tsx +import { Actions, agent, Button, Card, CardText } from '@novu/framework'; + +export const supportAgent = agent('support-agent', { + onMessage: async ({ message, ctx }) => { + const firstName = ctx.subscriber?.firstName; + const isFirstMessage = ctx.conversation.messageCount <= 1; + + if (isFirstMessage) { + return ( + + What can I help you with today? + +