Python SDK for the SLOP protocol — let AI observe and interact with your app's state
Project description
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.pick,slop_ai.omit,slop_ai.normalize_descriptorslop_ai.transports.asgi,.websocket,.unix,.stdio- scaling helpers such as
prepare_tree,truncate_tree, andauto_compact
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
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 slop_ai-0.1.0rc7.tar.gz.
File metadata
- Download URL: slop_ai-0.1.0rc7.tar.gz
- Upload date:
- Size: 35.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cd4ad82de6d95b0bc5c4e616ad560c839f50c44f7bb24117f9583a34e9d60b1
|
|
| MD5 |
5cf7694ee9d765d41578cba745246bf8
|
|
| BLAKE2b-256 |
aec0615770e925675a4c10c99a392e3cdc05bfe0fea653b5c7bed89042edd463
|
File details
Details for the file slop_ai-0.1.0rc7-py3-none-any.whl.
File metadata
- Download URL: slop_ai-0.1.0rc7-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8246b4f5427eab2b4baf9b9ced321aaca0a08112fcc5782f7742affda875fcbf
|
|
| MD5 |
de6409deb89660233543e6b9bcba0409
|
|
| BLAKE2b-256 |
7359ce38dd5e18341f1feb0ebdebb3633f7bf2ed262a8471cd5e98ad10b952a3
|