Skip to content

API Reference

The core embedding symbols are re-exported from the dango top-level package. The custom-extension SDK lives in dango.extensions.

Quick import table

python
from dango import (
    # Cogs
    ChatCog,
    AdminCog,

    # Workflow
    create_discord_workflow,

    # Config
    RuntimeConfig,
)

# Custom commands & tools (used inside custom/*.py — see the feature guide)
from dango.extensions import command, agent_tool, command_and_tool, Ctx

Where things live

SymbolTop-level importSub-module (also works)
ChatCogfrom dango import ChatCogfrom dango.commands import ChatCog
AdminCogfrom dango import AdminCogfrom dango.commands import AdminCog
create_discord_workflowfrom dango import create_discord_workflowfrom dango.workflow import create_discord_workflow
RuntimeConfigfrom dango import RuntimeConfigfrom dango.utils.runtime_config import RuntimeConfig
commandfrom dango.extensions import command
agent_toolfrom dango.extensions import agent_tool
command_and_toolfrom dango.extensions import command_and_tool
Ctxfrom dango.extensions import Ctx

Core symbols

ChatCog

Discord.py Cog that handles incoming messages. Wraps the Agno workflow and routes Discord events into the four-step pipeline.

Constructor:

python
ChatCog(
    bot: commands.Bot,
    discord_workflow: Workflow,
    chat_system_prompt: str,
    runtime_config: RuntimeConfig,
)

AdminCog

Discord.py Cog that registers admin slash commands (/addchannel, /adduser, etc.). Requires the Administrator server permission for all commands.

Constructor:

python
AdminCog(bot: commands.Bot, runtime_config: RuntimeConfig)

create_discord_workflow()

Creates and returns the Agno Workflow object. Call once at startup; pass the result to ChatCog.

RuntimeConfig(config_path)

Loads and manages config/runtime.yml. Stores allowed channels, allowed DM users, history limit, timezone, and activity string. Pass the same instance to both ChatCog and AdminCog.

Custom extensions (dango.extensions)

These are what you use inside custom/*.py. See Custom Commands & Tools for the full guide.

Decorators

Each decorator registers a function and supports bare usage (@command), positional (@command("name")), or keyword (@command(name=..., description=...)).

DecoratorDiscord slash commandAgent tool
command(name=None, description="")
agent_tool(name=None, description="")
command_and_tool(name=None, description="")

When name is omitted the function name is used; when description is omitted the first line of the docstring is used. A leading ctx parameter is optional and is stripped from the public command/tool schema.

register_tools(*tools)

Attach raw Agno tools to the agent — plain functions, @tool functions, Toolkit instances, or lists such as a context provider's get_tools(). Lists and tuples are flattened. Call it from a custom/*.py file; everything passed is exposed to the agent only (never a slash command).

python
from dango.extensions import register_tools
from agno.context.gdrive import GoogleDriveContextProvider

register_tools(*GoogleDriveContextProvider().get_tools())

Ctx

Dataclass describing where a function was invoked from, passed as the first argument when the function declares ctx.

AttributeType
sourcestr"discord_command" or "agent"
author_namestr
author_idint | None
channel_idint | None
channel_namestr
guild_idint | None
guild_namestr
mentioned_user_idslist[int] (agent path only)
mentioned_role_idslist[int] (agent path only)
author_permissionslist[str] (empty in DMs)
interactiondiscord.Interaction | None (command path only)
botcommands.Bot | None (command path only)

Loader functions

Called by the app at startup; you normally don't call these yourself.

FunctionEffect
load_custom_modules()Import every custom/*.py once so decorators register. Idempotent.
get_custom_tools()Return the registered tools as Agno tool objects for the agent.
register_custom_commands(bot)Add the registered slash commands to bot.tree; returns the count.

MIT License · Built on Agno