LogoNotion AI Hub Docs
LogoNotion AI Hub Docs
Homepage
Notion AI 基础
Custom Agent
Create Your First AgentInstruction Writing GuideDebugging & OptimizationKnowledge BaseTriggersModel SelectionRouting PatternCreditsKnown Limitations
Workers
Automation
最佳实践
X (Twitter)
Custom Agent

Routing Pattern

Learn how to manage multiple Notion Custom Agents using the routing pattern — reduce unnecessary credit consumption through entry-point routing and email label pre-filtering.

Routing Pattern

As your number of Agents grows, efficiently managing their triggers and coordination becomes a key challenge. The routing pattern is the core strategy for solving this problem.

The Problem: Multi-Agent Waste

Imagine you have three email Agents — one for orders, one for customer service, and one for Newsletters. Every time an email arrives, all three Agents wake up, each parsing the email independently. In the end, only one is actually relevant. The other two did work for nothing, wasting Credits.

The Solution: Single Entry Point Routing

The overall idea is to use just one Agent as the entry point, responsible for identifying and routing.

Layer 1: Email Label Pre-Filtering (Free)

  • If you subscribe to Notion AI, the official Notion Mail app can automatically label emails using AI
  • This step does not consume Custom Agent Credits
  • Change your email trigger to "When a label is applied to an email" — only matching emails will trigger the Agent

Notion Mail AI auto-labeling

Email trigger set to label-based

Layer 2: Instruction Sub-Pages Loaded on Demand

  • Each sub-scenario's execution rules are written in separate sub-pages
  • The main instruction references these sub-pages via @
  • The Agent only loads the corresponding sub-page content when it matches a route
  • When processing a Stripe order, the Agent won't read the Newsletter archiving rules

Sub-scenario instruction documents

Benefits of the Routing Pattern

  • Agents that shouldn't wake up don't wake up — saving Credits
  • Email labels filter out irrelevant messages before the Agent even starts
  • Instructions are loaded on demand rather than in full, reducing context consumption
  • Easier to maintain and extend: adding a new scenario only requires a new sub-page

Design Principle

Before creating a new Agent, beyond thinking about "what should it do," it's also worth asking "when should it NOT be woken up."

Last updated on

Model Selection

Understand the AI models available in Notion Custom Agent and how to choose the right model based on task complexity.

Credits

Understand the Credits billing system for Notion Custom Agent, real-world usage costs, and tips for saving Credits.

Table of Contents

Routing Pattern
The Problem: Multi-Agent Waste
The Solution: Single Entry Point Routing
Layer 1: Email Label Pre-Filtering (Free)
Layer 2: Instruction Sub-Pages Loaded on Demand
Benefits of the Routing Pattern
Design Principle