Write a plugin
This page is for plugin authors: declare resources, dependencies, and business parameters, then verify changes during development. For installation, candidate directories, and enabling existing plugins, see Use plugins.
Organize the directory and minimal manifest
A plugin is a directory with .plugin.yaml at its root. The directory name, manifest id, and ID in plugins.enabled must match. This minimal manifest registers one Python tool:
common/
├── .plugin.yaml
└── tools/
└── statistics.pyschema_version: 3
id: common
tools:
summarize_numbers:
entrypoint: tools/statistics.py:summarize_numberstools/statistics.py resolves relative to the plugin root; see Write tools for the function. Resolved resource paths must remain inside that root. See the plugin and extension configuration reference for fields, tool scope, and schema versions. The complete common example combines tools, Skills, a subagent, and hooks; it is not included in the wheel or enabled by default.
Load and verify during development
Merge this fragment into a product YAML with a configured model and replace the placeholder with the plugin directory. Keep one candidate directory per plugin ID. A Home copy and a source directory with the same ID conflict if both are candidates. See Use plugins for loading rules.
plugins:
enabled: [common]
paths:
- /absolute/path/to/commonStart the Server or create an SDK Agent with this configuration and leave dataagent.entry unset. Ask “Call common__summarize_numbers on 1, 2, and 3 and return its result.” Check the execution trace for the tool call and verify count: 3 and sum: 6 in the result. Compiled entries do not assemble the root Agent's tools.
Declare dependencies and parameter defaults
Manifest requires declares local dependencies. The host resolves existing candidates and loads dependencies first, once per ID. Missing dependencies, duplicate sources, and cycles fail loading. It does not install from the network or add Python import paths across plugins.
schema_version: 3
id: de-agent
requires:
- nl2sql
defaults_file: config.yamlparams declares defaults for the plugin's own business parameters. A defaults_file contains only plugins.config and can supply defaults for the plugin and its declared dependencies. Users override those values in their selected product YAML. See the merge reference and worked example.
Tools and hooks obtain a copy of effective settings through runtime.context.get_plugin_config("de-agent") and access session outputs through runtime.context.session.outputs. Use host-managed get_model(alias) and semantic_client rather than rereading .env or recreating shared clients for the same configuration. See Python API for types and ownership.
Verify changes and refresh
Server checks local extension fingerprints when preparing the next turn and attempts refresh; in-flight turns keep their original graphs. After changing declarations or Python code, verify with a task that actually invokes the modified tool or hook. Correct a failed refresh before retrying.
SDK callers rerun prepare_runtime and create_agent; custom long-lived hosts use the dataagent.host API. Model, Home, listener, and dataagent.entry changes require restart rather than extension refresh. See extension lifecycle for fingerprints, caches, and publication boundaries.