Plugin

Plugin

What a Downcity Plugin is and how it extends Agent capabilities

Plugin

A Plugin is a capability module that extends an Agent at runtime. Plugins are how the Agent SDK gains access to external systems, tools, channels, and workflows without changing the core execution engine.

What a plugin does

  • Exposes tools the Agent can call during execution
  • Hooks into the Agent lifecycle (start, stop, session events)
  • Manages its own state, connections, and background tasks
  • Runs inside the Agent process boundary, not as a separate service

Built-in plugins

Downcity ships several built-in plugins that cover common agent needs:

  • Chat — connects messaging channels (Telegram, Feishu, QQ, etc.)
  • Task — schedules and runs background tasks
  • Memory — persists conversation history and context
  • Contact — manages user contact lists and relationships
  • Shell — executes local commands in a sandboxed environment
  • Schedule — cron-style job scheduling
  • Web — browses the web and extracts content
  • Skill — composes reusable tool chains

Writing a plugin

Plugins are plain TypeScript classes that implement the Plugin API:

import { definePlugin } from "@downcity/agent-plugin";

export default definePlugin({
  id: "my-plugin",
  name: "My Plugin",
  version: "1.0.0",

  async init(context) {
    // lifecycle hook: called when the Agent starts
  },

  async destroy(context) {
    // lifecycle hook: called when the Agent stops
  },

  tools: [
    {
      id: "myTool",
      description: "Does something useful",
      async handler(args) {
        return { result: "done" };
      },
    },
  ],
});

Where to learn more