Skip to content
Developer Preview

MuseClient

Your entry point to the SDK.

Class in muse_code

Spawn a host with spawn, then open conversations with start_session or resume_session. The client owns the connection: it routes every server event to the session it belongs to and reports a host death to all of them. Call close to shut the host down cleanly.

MuseClient(connection: Connection, options: MuseClientOptions)

Name Type Description
connection A ready Connection.
options The durability profile and the optional owned host.
Property Type Description
initialize_result InitializeResult The handshake result, when this client was built by spawn.
exit Awaitable[ExitClassification] The host’s exit row, when this client was built by spawn.
durability SessionDurabilityProfile The durability profile every session this client opens inherits.
Method Signature Description
spawn async spawn(options: MuseClientSpawnOptions) -> 'MuseClient[Any]' Spawn an owned host, run the handshake, and hand back a client whose durability profile came from that handshake.
start_session async start_session(options: StartSessionOptions | None = None) -> Session[_I] Open a new root session.
resume_session async resume_session(options: ResumeSessionOptions) -> Session[_I] Load an existing session and subscribe this connection to its view.
close async close() -> None Shut the host down in an orderly way.
Source

clients/sdk-py/src/muse_code/facade/client.py:181