Writing one
Your code gets the arguments the assistant worked out in a variable called_input. Print your result as JSON — whatever you print is what the assistant
reads back.
_input and console.log:
total_eur tells it more than t.
Only the printed JSON comes back. If you print several lines, the last valid
JSON line is used; if nothing parses as JSON, the assistant gets the raw text
instead. Print once, at the end.
Reaching other values
Besides_input, you can drop variables straight into
your code before it runs:
_context holds the same call details programmatically.
Setting one up
Using libraries
You can add packages — pip for Python, npm for JavaScript — with a pinned version:requests is kept warm, so Python code using it starts immediately. Anything else
is installed the first time it’s needed, which adds a few seconds to that call.
Pin versions so a release upstream doesn’t change behaviour mid-week.
Where it runs
Your code runs in an isolated sandbox, separate from everything else. It can’t reach your other tools, your data, or the call itself — it gets its arguments, runs, and prints.
Keep it short. A code tool runs while a caller is waiting, so anything slow is
better done in your own system behind an HTTP tool.