slop-ai
Python SDK for the SLOP protocol.
The package includes provider and consumer APIs, descriptor helpers, tree scaling utilities, and transports for ASGI, WebSocket, Unix socket, and stdio flows.
Install
pip install slop-ai[websocket]
Use the websocket extra when you want the standalone WebSocket transport. The core package itself has no required runtime dependencies.
Quick start
from fastapi import FastAPI
from slop_ai import SlopServer
from slop_ai.transports.asgi import SlopMiddleware
app = FastAPI()
slop = SlopServer("my-api", "My API")
@slop.node("todos")
def todos_node():
return {
"type": "collection",
"items": [
{"id": str(todo.id), "props": {"title": todo.title, "done": todo.done}}
for todo in db.get_todos()
],
}
@slop.action("todos", "create", params={"title": "string"})
def create_todo(title: str):
db.create_todo(title)
app.add_middleware(SlopMiddleware, slop=slop)
Included modules
slop_ai.SlopServerandslop_ai.SlopConsumerslop_ai.discoveryfor provider scanning, bridge relay, lazy/auto-connect, and AI-facing tool helpersslop_ai.pick,slop_ai.omit,slop_ai.normalize_descriptorslop_ai.transports.asgi,.websocket,.unix,.stdio- scaling helpers such as
prepare_tree,truncate_tree, andauto_compact
Discovery layer
The Python SDK includes the core discovery layer in slop_ai.discovery:
import asyncio
from slop_ai.discovery import DiscoveryOptions, create_discovery_service
async def main() -> None:
service = create_discovery_service(DiscoveryOptions())
await service.start()
try:
provider = await service.ensure_connected("my-app")
if provider is not None:
print(provider.name)
finally:
await service.stop()
asyncio.run(main())
Install slop-ai[websocket] when discovery needs browser bridge support or direct WebSocket providers.
Documentation
- API reference: https://docs.slopai.dev/api/python
- Python guide: https://docs.slopai.dev/guides/python
- Protocol spec: https://docs.slopai.dev/spec/core/overview
Metadata
Release files for slop-ai 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| slop_ai-0.2.0.tar.gz | 53.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| slop_ai-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 102.2 kB
Release files / slop_ai-0.2.0.tar.gz
| Download URL | slop_ai-0.2.0.tar.gz |
|---|---|
| Size | 53.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68b557fc891e4bc78dc00df2314556bce6f12a5f8303ef393c6feb71ebfe8541
|
|
BLAKE2b-256 checksum How to use checksums |
3fe460a741f5508da58a51c5b5d48f1c2cbf874d2a5ba0bcbf24d7a34e64d5c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / slop_ai-0.2.0-py3-none-any.whl
| Download URL | slop_ai-0.2.0-py3-none-any.whl |
|---|---|
| Size | 49.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b351d6434e0086c211f447ddbe15b734ade7bf10eddbb27b5980a5332edeb25c
|
|
BLAKE2b-256 checksum How to use checksums |
36f73bf11d5055f21deb1983367f79e04cc91d1e9b0ceabc10a857ff3dbd3e66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|