Skip to main content
Glama

Cue

Per-person attention budgets for AI agents and background automations, self-hosted.

CI Python License: MIT Cue MCP server on Glama

Documentation · Getting started · Agents

A code-review agent, a log-triage agent and a billing agent can all page the same engineer at 2 a.m. A LangGraph interrupt() or a Slack approve button pauses one agent; none of them knows what the others already sent. Cue sits in front of all of them as the outbound gatekeeper:

  • Budgets per agent, per person. Each agent sends with its own key. Its frequency_caps limit how many messages it may send one person per period, and messages over budget are stored as suppressed with reason agent_budget. Category caps count what a person gets from every sender together.

  • Quiet hours in the person's time zone. A message due inside someone's quiet hours waits until they end. Only critical messages in categories people cannot unsubscribe from break through, and each agent's max_importance caps what it may claim, so only agents you trust can use critical.

  • Digests for the rest. A digest rule turns a stream of agent events into one message per window, or one per day at a local time.

  • Approval for risky messages. Messages that match an agent's approval condition wait as pending_approval; a reviewer decides from a one-time link in their own notification. Agent keys can never approve.

  • A reason for every outcome. Each message has a status and a status_reason, and each event records which rules matched and why. Agents connect over HTTP, the SDKs or the MCP server.

Use it as a library

No server needed: pip install cue-notify, then decide in-process, with state in a SQLite file. You send the message yourself.

from cue_notify.embedded import Gate

gate = Gate("sqlite:///cue.db", quiet_hours=("22:00", "08:00"), caps={"marketing": [("P1D", 1)]})
decision = gate.check("user-42", category="marketing", timezone="Europe/Berlin", key="sale-42")
if decision.action == "send":
    print("sending now")
    gate.sent(decision)
else:
    print(decision.action, decision.at, decision.reason)
for due in gate.due():
    print("sending", due.key)
    gate.sent(due)

check() answers send, defer (until decision.at), suppress or digest, with a reason; due() returns deferred messages and digest batches whose time has come. Quiet hours in each person's time zone, caps, cooldowns, per-sender budgets, digests and idempotency keys work as in the server; templates, channels and preference pages do not come with it. See Use Cue as a library.

The recording at the top is examples/agents-demo: from a checkout, uv run python examples/agents-demo/demo.py runs it with SQLite and the console connector.

Related MCP server: hitl-mcp

Quick start

With Docker Compose (PostgreSQL, an API and a worker; messages go to the worker's log):

git clone https://github.com/murtazox04/Cue && cd Cue
docker compose up --build -d
docker compose exec api cuectl keys create admin
docker compose logs -f worker

Or with Python 3.12+ and SQLite, in a virtual environment:

python -m venv .venv && . .venv/bin/activate
pip install cue-notify
export CUE_WORKER__EMBEDDED=true
export CUE_CHANNELS__PUSH__PROVIDER=console CUE_CHANNELS__SMS__PROVIDER=console
cuectl db upgrade && cuectl keys create admin && cuectl serve

keys create prints an API key once; keep it as CUE_API_KEY. Then follow the getting-started guide to create a template and a rule and send an event that shows up in the log, and agents to give an agent its own key and limits.

To try it without installing anything, with uv:

CUE_WORKER__EMBEDDED=true CUE_CHANNELS__PUSH__PROVIDER=console \
  CUE_CHANNELS__SMS__PROVIDER=console uvx cue-notify serve --migrate

and, in a second terminal in the same directory (both use ./cue.db), uvx cue-notify keys create admin.

More for agents

  • Agents as senders. Each agent gets its own key with a per-person attention budget, an importance ceiling and, where you want it, human approval before anything goes out. Agent keys cannot read or change people's profiles, and cannot approve anything. See agents.

  • Ask a person first. Before a risky action (a refund, a deletion, a mass e-mail), an agent calls POST /v1/approvals or the request_approval MCP tool. Cue tells the reviewers on their own channels with a one-time link and reports the decision back, with bridges for LangGraph, Pydantic AI, CrewAI Flows and Dapr Agents. See approval requests.

  • MCP server. uvx cue-notify mcp gives Claude, Cursor or your own agent tools to notify people and inspect delivery, under the same policy and audit trail. See AI agents (MCP).

  • Screening (optional, off by default, experimental). With [screening] enabled = true and a TypeSafe API key, a decision model (Jev) reads each agent message before it is sent: pressure, deception or leaked secrets hold it for a person, and overstated importance is lowered. Built against TypeSafe's published API; not yet proven in production. Your own backend's messages are never screened.

  • Coding agents. cue-hook lets OpenHands and Claude Code tell you when they finish or wait for input. See coding agents.

  • Claude Code plugin. /plugin marketplace add murtazox04/Cue, then /plugin install cue@cue, adds a skill for integrating Cue into an application.

Notifications from your own backend

The same policy serves your product's own notifications. Your backend reports what happened (order.shipped, payment.failed). Cue decides whether that is worth a notification, renders it in the person's language, picks the time and the route, and hands a finished message to the delivery you connect: your own sending service through a signed webhook, or a bundled connector.

  • Rules and policy in one place. JSON Logic rules map events to templates; every message, whether triggered by a rule, sent directly or broadcast, passes the same checks: unsubscribes, muted channels, frequency caps, cooldowns and quiet hours in the recipient's own time zone, checked again right before sending.

  • Fewer messages. Digests turn a burst of events into one message per window or one per day at a local time, and fatigue backs off from people who stopped engaging.

  • People in control. A hosted preference page (or a JSON API for your own), RFC 8058 one-click unsubscribe, and a consent ledger of every change.

  • Answers. Every event records which rules matched and why; every message records its status and the reason it was suppressed or failed.

curl -X POST https://cue.example.com/v1/events \
  -H "Authorization: Bearer $CUE_API_KEY" -H "Content-Type: application/json" \
  -d '{"name": "order.shipped", "recipient": "customer-42",
       "data": {"order_id": "1001"}, "idempotency_key": "order-1001-shipped"}'

Your delivery endpoint then receives a signed, fully rendered message:

{
  "id": "01a1…",
  "channel": "push",
  "address": "<device token>",
  "locale": "en",
  "importance": "normal",
  "expires_at": null,
  "content": {"title": "Your order is on its way", "body": "Order 1001 ships today.",
              "url": "https://shop.example/orders/1001"},
  "metadata": {"cue_message_id": "01a1…", "cue_tracking_token": "…"},
  "links": {"preferences": "https://cue.example.com/preferences/…"}
}

Who it's for

For teams whose agents, background jobs or product code send push, e-mail, SMS or chat messages to people, and who want the decisions (whether, when, how often, over which route, in which language) made in one place, stored, and explainable, on their own infrastructure.

Not for you (yet) if you need:

  • an in-app inbox or notification feed: planned, not built;

  • an admin UI: today you configure Cue through the HTTP API, the CLI and cue.toml;

  • a connector Cue does not have yet. Today's are FCM, APNs, Twilio, SMTP, Amazon SES, Resend, Slack, Telegram, a signed webhook and console, plus any you write;

  • a hosted service: Cue is self-hosted only;

  • a visual journey builder for marketing campaigns: not planned.

See the roadmap.

Bring your own delivery

Each route (push, sms, email, ops-alerts…) is backed by a connector:

Connector

Use it when

webhook

You already have a sending service, or want full control. Cue POSTs signed JSON to it.

fcm, twilio, smtp, telegram

You want a ready-made connector for these providers.

console

Local development: messages are logged.

your own

Write a small class and register it as a plugin; see custom connectors.

Connectors are configuration, not code changes: swap SMS vendors without touching a rule.

Also

  • SDKs. pip install cue-notify-client and npm install cue-client, both with webhook signature verification. See SDKs.

  • Engagement tracking. Delivered, opened, clicked, converted; client apps report with a per-message token, no API key needed.

  • Broadcasts. Audience filters, resumable batches, pause/resume/cancel without double sends.

  • Compliance. US texting hours and state caps for marketing texts, STOP/START replies, and opt-in records with the disclosure shown. See compliance.

  • Runs on your database. An API process and a worker process (or the worker embedded in the API for small installs), with PostgreSQL or SQLite. No Redis or message broker: the durable job queue lives in the database. Schedule cuectl prune yourself for retention.

  • Observable. Per-rule event outcomes, status reasons, Prometheus metrics, JSON logs.

  • Docs for tools. llms.txt and AGENTS.md.

How Cue compares

What it is

Difference from Cue

Novu

Notification infrastructure you can self-host.

Its self-hosting guide lists MongoDB, Redis and S3-compatible storage. Cue needs one database, PostgreSQL or SQLite.

Knock, Courier, OneSignal

Hosted notification services.

You sign up for their service; Cue runs on your infrastructure.

Apprise, ntfy

Tools that deliver a message to many services or devices.

They send what you hand them; whether and when a person should be notified (preferences, caps, quiet hours in their time zone, digests) is left to your code. Cue makes that decision, then hands the message to a sender.

Human approval inside an agent framework (LangGraph interrupt(), a Slack approve button)

A pause in one agent's run until a person answers.

It covers one agent and one decision; how many messages a person already got from your other agents tonight is not its concern. Cue applies budgets, quiet hours and digests across all of them, and its approval requests can resume LangGraph, Pydantic AI, CrewAI Flows and Dapr Agents.

Framework notification libraries (Laravel, Rails, Django…)

Code in your application that formats and sends notifications.

Policy, preferences and history are yours to build per application; Cue keeps them in one service that every application and agent calls.

How it works

flowchart LR
    E[POST /v1/events] --> R{Rules}
    R --> P[Policy<br/>unsubscribe · caps · cooldown · quiet hours]
    P --> T[Template<br/>locale · route variants]
    T --> Q[(Queue)]
    Q --> A[AI rewording<br/>optional]
    A --> C{Your delivery<br/>webhook · connectors}

Concept

In one line

Event

Something that happened to a recipient. Idempotent, stored with per-rule outcomes.

Rule

When event X (and condition) → send template Y over routes [A, B].

Template

Localised content with route-specific variants.

Category

Policy bundle: frequency caps, quiet hours, whether unsubscribing is allowed.

Channel

A named route (push, sms…) backed by a connector.

Message

One notification to one recipient, with a full status trail.

Broadcast

One template to an audience, in resumable batches.

Configuration

Environment variables (CUE_SECTION__KEY) or a cue.toml:

[database]
url = "postgresql+asyncpg://cue:secret@db/cue"

[api]
public_url = "https://cue.example.com"   # needs CUE_API__SECRET_KEY

[channels.push]
provider = "webhook"
url = "https://notifications.internal.example/push"   # secret from CUE_CHANNELS__PUSH__SECRET

[channels.sms]
provider = "twilio"
account_sid = "AC…"
from_number = "+15550100"   # auth token from CUE_CHANNELS__SMS__AUTH_TOKEN

See the configuration reference, deployment and examples/cue.toml.

Project status

Cue is in early development (0.x): the model and API are stable in shape but may still change before 1.0; each release's changelog says what to do when upgrading. See the roadmap for what comes next. Feedback and contributions are welcome; see CONTRIBUTING.md.

License

MIT

Available Tools

10 tools
explainA
Read-only

Dry-run an event for a person: which rules would fire, what each would do and why the others would not. Use it before send_event to check that a rule will reach the person; nothing is stored or sent. Needs an admin key, so agent keys get 403 and should read get_event for a real event instead.

Returns rules, one entry per rule listening for the name, with rule, matched, status (what the message would get, e.g. queued or suppressed), reason and digest_id, read like get_event's outcome. Fails with 404 when recipient does not exist yet.

Inputs: recipient (required), event_name (required), data.

get_approvalA
Read-only

Fetch an approval request by id to learn whether a person approved the action you asked about with request_approval. Call it again, with a pause, while status is pending. Needs the messages:read scope.

Returns id, status (pending, approved, rejected or expired; a request past expires_at reads as expired), title, body, reviewers, importance, agent, requested_by, metadata, comment (the reviewer's note, if any), decided_by, decided_at, expires_at and created_at. Treat anything but approved as no. Fails with 404 when the id does not exist or, for an agent key, belongs to another agent.

Inputs: approval_id (required).

get_eventA
Read-only

Fetch a reported event by id and, for each rule listening for its name, whether the rule fired and what came of it. Use it after send_event to learn what was sent and why or why not; follow a message_id with get_message for delivery, and use explain for a dry run instead. Needs the messages:read scope.

Returns id, name, source, idempotency_key, data, status (pending until the worker runs the rules, then processed, or failed with the reason in error), occurred_at, received_at and outcome: null while pending, else one entry per rule with rule, matched, reason, status, message_id and digest_id. matched: false comes with condition_false, outside_rollout or condition_error. A composed message has status and message_id, and reason is its status_reason when suppressed (e.g. agent_budget: …, unsubscribed); digested means it joined digest_id; agent_not_allowed means the agent may not use the rule's category. An empty list means no rule listens for the name. Fails with 404 when the id does not exist or, for an agent key, was reported by another sender.

Inputs: event_id (required).

get_messageA
Read-only

Fetch one message by id to learn whether and how a person was notified: delivery status and its reason, the channel used, the rendered content and engagement. Use it after send_message, or with a message_id from get_event; use list_messages when you have no id. Needs the messages:read scope.

Returns id, status (queued, sending, pending_approval, sent, delivered, failed, suppressed or cancelled), status_reason (why it was suppressed, failed, held or cancelled, e.g. frequency_cap: 3 per 1 day, 0:00:00 or agent_budget: …; null otherwise), category, template, channels (planned, in fallback order), channel (the one used), locale, content (rendered title, body, url… under default and each channel with its own override), importance, agent, event_id, rule_id, reviewed_by, reviewed_at, screening, attempts, send_at, expires_at, sent_at, delivered_at, opened_at, clicked_at, converted_at and created_at. Fails with 404 when the id does not exist or, for an agent key, belongs to another sender.

Inputs: message_id (required).

list_messagesA
Read-only

List recent messages, newest first, optionally for one person or status: what someone was already sent, what was suppressed, what waits for approval. Use get_message when you have an id. Needs the messages:read scope; agent keys see only their own messages.

Returns items, each with the same fields as get_message, and next_cursor, which is not null when older messages exist beyond limit. Fails with 404 when recipient is not a known external id.

Inputs: limit, status, recipient.

list_templatesA
Read-only

List the templates send_message can use, to find a template key. Use preview_template to see one's content. Needs an admin key, so agent keys get 403.

Returns templates, up to 200, each with key, description and locales.

Inputs: no named parameters.

preview_templateA
Read-only

Render a template with sample data to see the exact text a person would get, without sending anything. Use it to check which data a template needs before send_message; list_templates gives the keys. Needs an admin key, so agent keys get 403.

Returns locale (the one used) and variants: the rendered title, body, url and other content under default and under each channel with its own override. Fails with 404 for an unknown template and 422 when it cannot be rendered.

Inputs: template (required), data, locale.

request_approvalA

Ask people to approve or reject an action you are about to take outside Cue (deleting data, spending money, contacting many people), before you take it. Not for informing anyone: use send_event or send_message. Needs the messages:write scope.

Cue reports a cue.approval_requested event per reviewer, which the server's rules turn into a notification with a one-time review link; only people decide, no tool can. Returns the request: id, status (pending), title, body, reviewers, importance, metadata, expires_at and created_at. Then poll get_approval with the id and act only on approved. Agent keys may name only their agent's configured reviewers (403 otherwise) and have a limit of open requests (429, 10 by default).

Inputs: title (required), reviewers (required), body, metadata, +2 more.

send_eventA

Report that something happened to a person (e.g. order.shipped) and let Cue's rules decide whether and what to notify. Prefer it to send_message whenever a rule can cover the case. Needs the events:write scope.

Rules run asynchronously, so the result only confirms receipt: id, status (pending until processed) and duplicate (true when this idempotency key was already reported; nothing new happens). Call get_event with the id to see, per rule, whether it matched and which message it produced. An unknown recipient gets an empty profile, so a message may end suppressed with no_reachable_channel. For agent keys, the messages count against the agent's per-person budget, are capped at its importance ceiling and may wait for approval. Fails with 403 for names starting with cue. and 422 for invalid input.

Inputs: name (required), recipient (required), data, idempotency_key.

send_messageA

Send one template directly to one person over the channels you list, without rules. Use it for an explicit one-off message (a code, a reply, an alert) when you know the template key; otherwise prefer send_event. Needs the messages:write scope.

The message still passes its category's policy (preferences, frequency caps, quiet hours, unsubscribes) and, for agent keys, the agent's per-person budget, importance ceiling and approval policy. Returns the message, with the same fields as get_message. status is queued, suppressed (read status_reason) or pending_approval (held for a person: do not resend). Repeating an idempotency_key returns the original message instead of sending again. Fails with 404 for an unknown template or category, 403 when an agent may not use the category and 422 for a channel the server does not have.

Inputs: channels (required), template (required), recipient (required), data, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action, and descriptions explicitly cross-reference to prevent confusion (e.g. send_event vs send_message, get_event vs get_message, explain vs preview_template). The send/get pairs operate on different entities (events vs messages), so an agent can reliably select the right tool.

    Naming Consistency4/5

    Names follow a predictable snake_case verb_noun pattern (list_templates, send_message, get_approval, etc.) with consistent list/get/send/request/preview prefixes. The only deviation is 'explain', a bare verb that breaks the pattern, though it remains clear.

    Tool Count5/5

    10 tools is well within the ideal 3-15 range for an agent-facing notification platform, and each tool covers a distinct operation (send, inspect, dry-run, approvals). No tool feels redundant or missing from a count perspective.

    Completeness4/5

    The surface covers core agent workflows: templates (list, preview), sending (event, message), inspection (event, message, list), approvals (request, get), and dry-run (explain). Minor gaps exist—no list_events, list_approvals, or message cancellation—but agents can work around these for most tasks.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Human-in-the-loop approvals and notifications for AI agents via WhatsApp. Enables Cursor, Claude Code, and autonomous AI agents to reach users away from their computers.
      112 npm
      ISC
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to request human decisions and send notifications through chat platforms like Slack and WhatsApp, with ephemeral in-memory pending requests and no central backend.
      2
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Let AI agents notify you on Slack, Telegram, email, SMS, or push via an Alphorn webhook.
      1
      57 npm
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Universal notification infrastructure for AI Agents. Enables Claude, Cursor, and DeepSeek to push real-time alerts to 80+ platforms (Telegram, Discord, Slack, Email) via Apprise.
      MIT