Before you start
Get an API key from celesto.ai under Settings > Security. Set it asCELESTO_API_KEY before you run the examples.
Pick a stable string for the end user you are running on behalf of, such as "usr_8837" or an email. Celesto uses that string as the record key; you never store a Celesto ID.
Install the Python SDK
Create an agent and stream a run
Createmanaged_agent.py:managed_agent.py
The script prints the agent’s answer as it streams, then a summary line showing how much this user has spent and their cap.
What just happened
agents.createcut version 1 ofsupport-bot. Every later update cuts a new version and leaves the old ones readable.runs.streamyieldedRunEventobjects:run.started,message.delta(partial text),message.completed,usage, and finallyrun.completedorrun.failed. Event names this SDK does not know are ignored.end_users.getreturned the same"usr_8837"string you passed in.spent_usdandcap_usdareDecimal, notfloat.
Wait instead of streaming
runs.create waits and hands you the settled run:wait.py
Set a budget
Give one user a cap, or set the default for everyone:budget.py
float raises TypeError rather than sending it. Pass a Decimal or a string.