Skip to main content

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.SlopServer and slop_ai.SlopConsumer
  • slop_ai.pick, slop_ai.omit, slop_ai.normalize_descriptor
  • slop_ai.transports.asgi, .websocket, .unix, .stdio
  • scaling helpers such as prepare_tree, truncate_tree, and auto_compact

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slop_ai-0.1.0rc3.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slop_ai-0.1.0rc3-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file slop_ai-0.1.0rc3.tar.gz.

File metadata

  • Download URL: slop_ai-0.1.0rc3.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

Hashes for slop_ai-0.1.0rc3.tar.gz
Algorithm Hash digest
SHA256 be0f6187fd57b5039e61e54cb05866a6773a66c85b5c4d51ee9d960741455582
MD5 77f5c1a65b0a035da05cfbcd3e9ac088
BLAKE2b-256 75e599327e1c4f638d7640e31ccdb2db4b8241cc9709c8d1a65989a0f4e84a76

See more details on using hashes here.

File details

Details for the file slop_ai-0.1.0rc3-py3-none-any.whl.

File metadata

  • Download URL: slop_ai-0.1.0rc3-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

Hashes for slop_ai-0.1.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 0f459b0373c9cffe5377041ce2760ff2c47517e5c6e77d9572d8a22aaf75270e
MD5 86fb7c48942ffd1f54790d8225897937
BLAKE2b-256 c824c3b675a95bb1e3c98d1014bbc442bdf2fa74382da90808da298716c32b8b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page