About the cookbook
Each page in this group solves one task you are likely to have while building
on the SDK — in TypeScript (@muse-code/sdk, npm install @muse-code/sdk)
or in Python (muse-code-sdk, import muse_code): stream an answer into your
UI, ask your user to approve a tool call, cancel a turn they are watching,
handle a host that is newer than your SDK, and more as the cookbook grows.
Every code step carries a TypeScript and a Python tab; pick your language
once and the tabs follow you across pages.
Every recipe is real, runnable code, and it is yours — in both languages. The
TypeScript program behind each page lives in clients/sdk-cookbook/ of the
SDK repository, and its Python twin (same recipe ids, same steps) in
clients/sdk-cookbook-py/ — though the Python trees are not mirrored to
the public repository yet, so today this clone carries only the TypeScript
sources:
git clone https://github.com/meta-models/muse-code-sdkEvery recipe — TypeScript and Python twin alike — runs on changes to this
area, against a release-built muse binary and against the committed
conformance transcripts, so one that stops working turns the build red
instead of quietly going stale. The wire exchanges you see on these pages are
checked against those same committed transcripts on every docs build. The one
deliberate behavioural fork between the languages is on the
fingerprint page: TypeScript
surfaces a mismatch as a warning value, Python fails initialize with a
typed error.
If you have not run anything yet, start with the quickstart — it takes you from nothing to a working session. Come back here when you have a task-shaped question.
One note that applies to every recipe: the harness launches its hosts with
MUSE_EXPERIMENTAL_SDK_ENABLED set explicitly. muse serve now runs by
default; the variable survives as an off-switch, and the harness pins the run
open so an operator’s off in the environment cannot silently change what
these recipes prove. That is not advice for your application. It is how
this test harness launches a host today; build your client against
muse serve as a supported command.