Skip to main content
Megan ships inside the cadenza-cli Python package. The client is standard-library only — it pulls in no third-party dependency and needs no extras (gym / lora / rl / vla), so it’s safe to add to a lightweight project.
The standalone cadenza binary bundles its own Python and is not importable. To use the SDK from your own code, install the Python package into your project’s environment.

1. Install the package

pip install cadenza-cli
# or, from a source checkout:
git clone https://github.com/aparekh02/cadenza.git
cd cadenza-cli && pip install -e .
Verify the import:
python -c "from cadenza_cli import MeganTK; print('ok')"

2. Get a token

Your API key is your Cadenza sign-in token. If you don’t have one, request one by emailing acparekh@stanford.edu, then sign in once so the CLI caches it:
cadenza login <name> <token>
Print it back any time — with a ready-to-paste snippet — using apikey:
cadenza apikey
# megan-tk API key  (= your sign-in token)
#   3Ls6••••••••••••QFvT
#   pass --reveal to print it in full
Treat the token like a secret. apikey masks it by default; pass --reveal only when you need the full value, and prefer an environment variable over hard-coding it in source.

3. How the key is resolved

MeganTK() finds your key in this order — the first hit wins:
1

Explicit argument

MeganTK(api_key="...")
2

CADENZA_API_KEY

Environment variable — the recommended way to configure a deployed app.
3

CADENZA_TOKEN

Environment variable — accepted as an alias.
4

CLI session

~/.cadenza/config.json — so a machine that ran cadenza login just works.
If none resolve, the constructor raises AuthRequired with a message telling you how to supply one.
export CADENZA_API_KEY=<your-token>
from cadenza_cli import MeganTK

tk = MeganTK()          # reads CADENZA_API_KEY / CADENZA_TOKEN / CLI session
print(tk.version())     # {'service': 'megantk', 'megantk_version': '0.1.0', ...}
print(tk.ping())        # True if the token authenticates

4. Your first decision

from cadenza_cli import MeganTK

tk = MeganTK()

with tk.session(objective="pick up the red cube",
                milestones=["reach", "grasp", "lift"]) as s:
    # nothing reached yet, and a wall is blocking the first milestone
    d = s.step(reached=[], obstacles=[{"id": "wall", "milestone": 0}])
    print(d.route, "→", d.frontier)     # e.g. adapt → milestone_0

    d = s.step(reached=[0])             # cleared it
    print(d.route, "→", d.frontier)     # continue → milestone_1

Configuration reference

SettingHow to set itDefault
API keyMeganTK(api_key=...), CADENZA_API_KEY, CADENZA_TOKEN, or CLI session— (required)
API URLMeganTK(api_url=...) or CADENZA_API_URLhttps://www.api.cadenzalabs.xyz
Timeout (s)MeganTK(timeout=...)30.0
Point CADENZA_API_URL (or api_url=) at a locally-running Cadenza API for development. In production, leave it unset to use the hosted service.

Next

Token sessions

The milestone and perception decision paths.

Usage & metering

See exactly what you’ve consumed.