SDK for building Soothe plugins and client utilities - restructured module architecture (breaking change)
Project description
Soothe SDK
A lightweight, decorator-based SDK for building Soothe plugins.
Installation
pip install soothe-sdk
Quick Start
from soothe_sdk.plugin import plugin, tool, subagent
@plugin(
name="my-plugin",
version="1.0.0",
description="My awesome plugin",
dependencies=["langchain>=0.1.0"],
)
class MyPlugin:
"""My custom plugin with tools and subagents."""
@tool(name="greet", description="Greet someone by name")
def greet(self, name: str) -> str:
"""Greet a person."""
return f"Hello, {name}!"
@subagent(
name="researcher",
description="Research subagent with web search",
model="openai:gpt-4o-mini",
)
async def create_researcher(self, model, config, context):
"""Create research subagent."""
from langgraph.prebuilt import create_react_agent
# Get tools
tools = [self.greet]
# Create agent
agent = create_react_agent(model, tools)
return {
"name": "researcher",
"description": "Research subagent",
"runnable": agent,
}
Features
- Decorator-based API: Simple
@plugin,@tool,@subagentdecorators - Lightweight: Only requires
pydanticandlangchain-core - Type-safe: Full type hints and Pydantic validation
- No runtime dependency: SDK is separate from Soothe runtime
API Reference
@plugin
Defines a Soothe plugin with metadata.
@plugin(
name="my-plugin", # Required: unique identifier
version="1.0.0", # Required: semantic version
description="My plugin", # Required: description
dependencies=["arxiv>=2.0.0"], # Optional: library dependencies
trust_level="standard", # Optional: built-in, trusted, standard, untrusted
)
class MyPlugin:
pass
@tool
Defines a tool that can be used by the agent.
@tool(name="my-tool", description="What this tool does")
def my_tool(self, arg: str) -> str:
return f"Result: {arg}"
@tool_group
Organizes multiple related tools.
@tool_group(name="research", description="Research tools")
class ResearchTools:
@tool(name="arxiv")
def search_arxiv(self, query: str) -> list:
pass
@tool(name="scholar")
def search_scholar(self, query: str) -> list:
pass
@subagent
Defines a subagent factory.
@subagent(
name="researcher",
description="Research subagent",
model="openai:gpt-4o-mini", # Optional default model
)
async def create_researcher(self, model, config, context):
# Create and return subagent
return {
"name": "researcher",
"description": "Research subagent",
"runnable": agent,
}
PluginContext
Provides access to Soothe internals in lifecycle hooks.
class MyPlugin:
async def on_load(self, context: PluginContext):
# Plugin-specific config
self.api_key = context.config.get("api_key")
# Global Soothe config
self.model = context.soothe_config.resolve_model("default")
# Logging
context.logger.info("Plugin loaded")
# Events
context.emit_event("plugin.loaded", {"name": "my-plugin"})
Plugin Lifecycle
Plugins can implement optional lifecycle hooks:
class MyPlugin:
async def on_load(self, context: PluginContext):
"""Called when plugin is loaded. Initialize resources."""
pass
async def on_unload(self):
"""Called when plugin is unloaded. Clean up resources."""
pass
async def health_check(self):
"""Return plugin health status."""
from soothe_sdk.plugin import Health
return Health(status="healthy")
Publishing Your Plugin
- Create a Python package with your plugin class
- Add the entry point in
pyproject.toml:
[project.entry-points."soothe.plugins"]
my_plugin = "my_package:MyPlugin"
- Publish to PyPI:
pip install build
python -m build
twine upload dist/*
- Users can install and use your plugin:
pip install my-plugin
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
# Type checking
mypy src/soothe_sdk/
# Linting
ruff check src/soothe_sdk/
# Formatting
ruff format src/soothe_sdk/
Architecture
The SDK provides decorator-based APIs for defining plugins (v0.4.0 structure):
soothe_sdk/
├── __init__.py # Minimal (version only)
├── events.py # Core concept at root
├── exceptions.py # Core concept at root
├── verbosity.py # Core concept at root
├── protocols/ # Protocol definitions (stable interfaces)
├── client/ # Client utilities (WebSocket + config)
│ ├── protocol.py # WebSocketClientProtocol
│ ├── websocket_client.py
│ └── config.py # Config constants + types (merged)
├── plugin/ # Plugin API (decorators + types)
│ ├── decorators.py # @plugin, @tool, @tool_group, @subagent (merged)
│ ├── manifest.py # PluginManifest (Manifest alias)
│ ├── context.py # PluginContext (Context alias)
│ ├── health.py # PluginHealth (Health alias)
│ ├── registry.py # register_event() API
│ └── emit.py # emit_progress(), set_stream_writer()
├── ux/ # UX/display helpers
│ ├── classification.py # classify_event_to_tier
│ └── internal.py # Internal content filtering
├── utils/ # Shared utilities
│ ├── logging.py
│ ├── display.py
│ ├── parsing.py
│ └── workspace.py
Import Pattern (v0.4.0):
# Core concepts - import from root
from soothe_sdk import __version__
from soothe_sdk.events import SootheEvent, OutputEvent
from soothe_sdk.exceptions import SootheSDKError
from soothe_sdk.verbosity import VerbosityLevel, VerbosityTier
# Purpose packages - import from subpackage
from soothe_sdk.plugin import plugin, tool, subagent, register_event
from soothe_sdk.client import WebSocketClient, VerbosityLevel
from soothe_sdk.ux import classify_event_to_tier
from soothe_sdk.utils import format_cli_error, setup_logging
Key Design Principles
- Lightweight: Minimal dependencies (only
pydanticandlangchain-core) - Type-safe: Full type hints and Pydantic validation
- Decorator-based: Simple, declarative plugin definition
- Runtime-agnostic: No dependency on Soothe runtime
- Extensible: Support for tools, subagents, and custom events
License
MIT License - see LICENSE for details.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file soothe_sdk-0.3.6.tar.gz.
File metadata
- Download URL: soothe_sdk-0.3.6.tar.gz
- Upload date:
- Size: 34.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0de784a48cc9675de52da072823869eb6d9411c992e4e42a1714ed0ab39baf4
|
|
| MD5 |
7d1d1b2441463d579e322d4048c29d12
|
|
| BLAKE2b-256 |
f12308ce69e55b4b1dafa5268b8f0f7f691a28fb3f754bbfbb0884bac90d9044
|
Provenance
The following attestation bundles were made for soothe_sdk-0.3.6.tar.gz:
Publisher:
release.yml on OpenSoothe/soothe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
soothe_sdk-0.3.6.tar.gz -
Subject digest:
e0de784a48cc9675de52da072823869eb6d9411c992e4e42a1714ed0ab39baf4 - Sigstore transparency entry: 1355979594
- Sigstore integration time:
-
Permalink:
OpenSoothe/soothe@e23fcb6d7a477e9c3724a893dcf6ed25fb83b9d3 -
Branch / Tag:
refs/tags/0.3.6 - Owner: https://github.com/OpenSoothe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e23fcb6d7a477e9c3724a893dcf6ed25fb83b9d3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file soothe_sdk-0.3.6-py3-none-any.whl.
File metadata
- Download URL: soothe_sdk-0.3.6-py3-none-any.whl
- Upload date:
- Size: 47.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
394abd54fae0d01ab3bcd116a01cbe5ae37b704e0534a879b6aba266b6a74fe3
|
|
| MD5 |
b2b1ed4d963a56a4b5f070318c8bb034
|
|
| BLAKE2b-256 |
06729ba9436496ada620cd0763e184bde78294b274b598a2246427a7f8707e98
|
Provenance
The following attestation bundles were made for soothe_sdk-0.3.6-py3-none-any.whl:
Publisher:
release.yml on OpenSoothe/soothe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
soothe_sdk-0.3.6-py3-none-any.whl -
Subject digest:
394abd54fae0d01ab3bcd116a01cbe5ae37b704e0534a879b6aba266b6a74fe3 - Sigstore transparency entry: 1355979631
- Sigstore integration time:
-
Permalink:
OpenSoothe/soothe@e23fcb6d7a477e9c3724a893dcf6ed25fb83b9d3 -
Branch / Tag:
refs/tags/0.3.6 - Owner: https://github.com/OpenSoothe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e23fcb6d7a477e9c3724a893dcf6ed25fb83b9d3 -
Trigger Event:
release
-
Statement type: