Muscles SSE
Server-Sent Events adapter for Muscles streaming use cases.
This package should provide progress, logs, notifications, and AI output streams over SSE while keeping the underlying workflow in the Muscles application model.
Related Repositories
muscles- coreStreamResult,StreamEvent, actions and dispatcher.muscles-asgi- HTTP runtime that can expose SSE responses.muscles-ai- AI/RAG actions that may produce streaming output.muscles-jsonrpc- sibling protocol projection over actions.muscles-benchmarks- streaming regression checks.
Concept Guardrails
- SSE streams must be backed by Muscles actions/events/jobs, not ad hoc handlers.
- The adapter must preserve shared rules/security and request context.
- Stream events must have typed names and payload schemas.
- SSE should be the simple default for one-way streaming before WebSocket is introduced.
- The package must be usable from ASGI without forcing unrelated runtime choices.
Implemented Features
Implemented SSE transport projection over Muscles action execution:
- action dispatch path:
dispatcher.execute(action, payload, transport="sse"); - application facade:
SseAdapter.from_application(app)backed by coreActionDispatcher; - stream normalization delegates to core
stream_events()/StreamResult; - typed events:
progress,log,result,error; - wire formatting:
id,event,retry,data; SseResponsewith SSE headers and status;- configurable interval heartbeat with bounded backpressure;
- safe source close on stream completion/disconnect;
- structured core action error mapping: not found, validation, permission, execution.
This keeps SSE as a thin delivery layer. Business logic stays in Muscles actions.
SseAdapter.execute() returns an SseResponse, which carries the event stream
and SSE response metadata. It is a protocol result, not a framework HTTP
response: the hosting ASGI integration must forward its status and headers and
stream its body to the client.
Interval heartbeat
SSE serializes core StreamEvent items from StreamResult. Business events
come from muscles.core; this package owns the SSE wire format and transport
heartbeat, backpressure, and disconnect behavior.
adapter = SseAdapter(
dispatcher,
heartbeat_event="heartbeat",
heartbeat_interval_seconds=15,
)
When the action stream is quiet longer than the configured interval, the transport emits a heartbeat event:
event: heartbeat
data: {"ok": true}
User events keep their existing SSE format. Closing the response stream stops
the heartbeat worker and closes the underlying source when it supports
close(). Backpressure is preserved with a bounded one-item queue. Long-
blocking sources should implement a cooperative close() that unblocks the
active next() call.
Run tests
python -m pytest -q
Metadata
Release files for muscles-sse 2.0.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 | Provenance | Actions |
|---|---|---|---|---|
| muscles_sse-2.0.0.tar.gz | 9.8 kB | With provenance | Details for muscles_sse-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| muscles_sse-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for muscles_sse-2.0.0-py3-none-any.whl |
Total release size: 15.7 kB
Release files / muscles_sse-2.0.0.tar.gz
| Download URL | muscles_sse-2.0.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0de0075024cf58986521a4c7a6902ed2c475ecf5311a726ecafcb4019769ed54
|
|
BLAKE2b-256 checksum How to use checksums |
920325d2443bac5bf3f049b9aa9988bef26e9b889e8b43e5a7aa1043653b8182
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logRelease files / muscles_sse-2.0.0-py3-none-any.whl
| Download URL | muscles_sse-2.0.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40d2141ce1e526209f7a3459cd2d86a7d99cadb0140e6599029330fc93eefcb9
|
|
BLAKE2b-256 checksum How to use checksums |
3ea31f3e6334580869ce65063b8bc116c631a04ab6189b12c86d0898d0ba7d06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logSecurity for muscles-sse 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for muscles_sse-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.