1
Install the SDK
krun-ai on PyPI. You import it as krun.2
Set your API key
The SDK reads the key from the
KRUN_API_KEY environment variable.3
Make a decision
Create Run it:
decide.py:decide.py
4
Handle abstention
When the model is not confident enough, it abstains: See Abstention for when to trust this signal.
answer.choice is None and answer.abstain is True. The probabilities are still there if you want a best guess.The numbers above come from a real call. Your values can differ slightly between calls and model updates, so don’t hard-code them in tests.
Use the HTTP API directly
The same request with curl:X-Request-ID response header (curl -i shows it). You need it to send feedback.
Next steps
Questions and answers
How requests and answers are structured.
Multiple questions
Ask several questions about the same text in one call.
Tool routing
Pick a tool for an agent step.
Python SDK
Async client, errors, timeouts and retries.