quivr-plugin-sdk (import quivr_plugin) implements the Plugin Protocol v0
(contract, Plugin API 0.2) so that a
Python normalizer or alert rule is a single function. It has no Temporal, Weaviate or database clients, and its
only runtime dependencies are PyYAML and jsonschema (both MIT). Python 3.12 or
later.
The SDK is installed from this repository; it is not published to PyPI in v0.
quivr plugin init <name>. It writes a working
text/markdown normalizer, a fixture and tests that use only this SDK.
quivr plugin init <name> --kind subscription writes an alert rule instead.
A normalizer
An alert rule
An alert rule is thesubscription Contribution. It receives one Record
Version’s text Parts and a batch of distinct evaluations (a Saved Query
expression and a Subscription configuration each, already validated against
the manifest’s expression_schema and configuration_schema), and returns one
decision per evaluation:
not_ready(evaluation) defers a decision, for example until
invocation.enriched. A decision must depend only on the record, the
expression and the configurations: the core batches, deduplicates and replays
evaluations freely.
What the SDK does
Testing a plugin
invoke_fixture builds the same request quivr plugin dev --fixture sends,
using an invocation fixture (contracts/plugins/v0/plugin-fixture.schema.json),
and runs the normalizer route in process. Plugin.invoke(request) and
Plugin.handle(method, path, body) expose the same dispatch without HTTP.
For an alert rule, invoke_subscription_fixture(plugin, "fixtures/sample.json")
builds the same batches as quivr plugin dev and the Contract Runner from a
subscription fixture (contracts/plugins/v0/subscription-fixture.schema.json),
runs them through Plugin.evaluate(request), and fails when a decision
differs from the fixture’s expect. build_subscription_requests returns the
requests themselves.
Maintaining the SDK
contracts/shared/v0/manifest.schema.json and
contracts/plugins/v0/*.schema.json. Never edit models.py or
src/quivr_plugin/schemas/ by hand.