* fix(extensions): roll back shared state mutations on budget check failure In deerflow_extension_agent_teams.shared_state, publish() and update() mutated team['public_state'] in-memory before invoking check_budget(). When check_budget() raised a budget-exceeded ValueError (e.g. 16,000 JSON bytes or 24,000 shared context bytes), the state mutation was not rolled back, causing: 1. Permanent state lockout on rejected publish (the oversized entry remained in state['entries']). 2. False optimistic concurrency conflicts on update retry (the entry revision was prematurely bumped and content altered). Wrap check_budget() in try-except in both functions: - On publish failure: pop the appended entry and decrement revision. - On update failure: restore original entry dict and decrement revision. - Added regression test covering both rollback scenarios. * test(extensions): request plugin fixture for isolated regression run * fix(extensions): add rollback identity guard and pin retry assertions
Develop an extension from an existing example
Start with the smallest example that covers your extension. Each directory is an
independent Python package using the public deerflow-extension-api contract.
| Start here | What it demonstrates |
|---|---|
| Extension example | Middleware, task lifecycle, model observations, services, and HTTP routes. Start here for backend extensions. |
| Conversation bookmarks | A browser page, conversation action, backend actions, packaged resources, and a model tool. Start here for full-stack plugins. |
| Agent teams | Full Agent orchestration. Use this after the basic contribution and lifecycle patterns are familiar. |
Additional examples cover text-list classification, context pruning, advisory screening of fetched content, and sectioned long-form report writing.
Edit, test, check, then install
-
Copy the selected example outside the DeerFlow checkout. Rename its Python package, distribution and
deerflow.extensionsentry point. For a full-stack plugin, also choose its own namespace and browser module name. -
Follow the example's README to configure its dependencies and run its tests. Keep package behavior tests alongside the extension. For a bundled example with a
tests/directory, CI installs the package with itsdevextra next to this checkout'sdeerflow-extension-api, then runspytest,ruff checkandruff format --check. -
From the DeerFlow checkout root, prepare the backend environment with
make -C backend install, then check the package:uv run --project backend --no-sync python scripts/check_extension.py /absolute/path/to/your-extensionTo try the checker on an unchanged example:
uv run --project backend --no-sync python scripts/check_extension.py examples/deerflow-extension-bookmarks -
Follow that example's deployment and try-it instructions. Restart Gateway, refresh the browser when applicable, and exercise the installed feature. Use
make extension-upgrade SOURCE=/absolute/path/to/your-extensionto apply later source edits: local installs are snapshots.
What the checker covers
The script builds a wheel in a temporary directory, checks exactly one extension
entry point and its packaged Python module, parses packaged Python syntax, and
checks that the API dependency range accepts this checkout's contract version.
It validates conventional ui_manifest.json resources with the same validator
used by Gateway, including detecting manifests left out of the wheel in flat or
src/ layouts. A custom manifest filename needs an explicit wheel-relative path:
uv run --project backend --no-sync python scripts/check_extension.py /absolute/path/to/your-extension --manifest your_package/resources.json
The build executes the package's build backend, so check trusted sources. The
checker does not import the extension, call install(), install the extension, or
change deployment configuration. Registration/configuration behavior and the
@extension version marker are verified when loading the plugin; continue to run
the package tests and the installed feature after packaging checks pass.