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.
Constructor
Section titled “Constructor”MuseClient(connection: Connection, options: MuseClientOptions)
Constructor parameters
Section titled “Constructor parameters”| Name | Type | Description |
|---|---|---|
connection |
A ready Connection. |
|
options |
The durability profile and the optional owned host. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
initialize_result |
InitializeResult |
The handshake result, when this client was built by spawn. |
exit |
Awaitable[ExitClassification] |
The host’s exit-classification row, when this client was built by spawn. |
durability |
SessionDurabilityProfile |
The durability profile every session this client opens inherits. |
Methods
Section titled “Methods”| Method | Signature | Description |
|---|---|---|
spawn |
async spawn(options: MuseClientSpawnOptions) -> 'MuseClient[Any]' |
Spawn an owned host, run the protocol 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. |
list_sessions |
async list_sessions(options: SessionListParams | None = None) -> SessionListResult |
List stored sessions (session/list), including text search. |
list_models |
async list_models(options: ModelListParams | None = None) -> ModelListResult |
List the models the host accepts in Session.set_model (model/list). |
read_usage |
async read_usage() -> UsageReadResult |
Read the host’s last-observed subscription usage (usage/read) without a model call; usage is absent when nothing was observed. |
command |
async command(method: str, params: Mapping[str, Any], *, command_id: str | None = None, max_attempts: int | None = None, retry_delay: RetryDelay | None = None) -> Params |
Send a wire method directly, typically one the facade does not wrap. |
close |
async close() -> None |
Shut the host down in an orderly way. |
Source
clients/sdk-py/src/muse_code/facade/client.py:345