Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Python

Package: dnotifier

Setup

import os
from dnotifier import DNotifier

notifier = DNotifier(
    app_id=os.environ["DNOTIFIER_APP_ID"],
    secret=os.environ["DNOTIFIER_SECRET"],
    transport="http",
    user_id="user-123",
    permission_enforcement="backend",  # or "disabled"
    on_agent_event=lambda event: print(event.get("type"), event.get("toolId")),
)

await notifier.connect()

Register a local tool

async def add_numbers(input_data, context):
    return {"sum": float(input_data["a"]) + float(input_data["b"])}

add = notifier.tools.register(
    {
        "name": "math.add",
        "description": "Add two numbers",
        "inputSchema": {
            "type": "object",
            "properties": {
                "a": {"type": "number"},
                "b": {"type": "number"},
            },
            "required": ["a", "b"],
        },
        "execute": add_numbers,
    }
)

execute must be awaitable (use async def).

Connect MCP

Define a tool agent

Classic agents still use define_agent(name, run=...). Tool agents may omit run.

Run standalone

Inside a workflow

Errors

Import typed errors from dnotifier (for example ToolNotFoundError, PermissionDeniedError, MCPConnectionError, LLMError).

Learn more

Last updated