Set up the Toolving Python SDK (instructions for agents)
Set up the Toolving Python SDK in this project for me. Follow the instructions at https://toolving.com/agents.mdYou are a coding agent setting up the Toolving Python SDK for your user. Follow these steps in order. Do each one yourself, and stop to ask the user only where a step says so.
The SDK lets your user's own program teach Conceiver, query it, and save what it learned. It also ships a skill, toolving-conceiver, that teaches you (the agent) how to use Conceiver: step 4 installs it in your harness so you have it in later sessions. If your user wants their coding agent itself to learn the commands it repeats, set up the agent harness instead.
Every step has a section for each system. Use the one that matches the shell you are running commands in:
- Linux and macOS: bash, zsh or fish.
- Windows PowerShell: Windows PowerShell 5.1 or PowerShell 7 on Windows itself.
- WSL: a Linux shell inside Windows Subsystem for Linux. Follow the Linux steps. WSL has its own Python, its own packages and its own environment variables, separate from Windows.
1. Check Python
You need Python 3.10 or newer.
Linux, macOS and WSL
python3 --version
Windows PowerShell
py -3 --version # the Python launcher; if it is missing, try: python --version
If the project already has an environment, use it: an active virtual environment or conda environment, or a project managed by uv, Poetry or PDM. The installer installs into the environment it finds (step 3). Do not create a new one, and do not install a tool such as uv or Poetry, unless the user asks you to.
If Python is missing or too old, tell the user which version to install for their system, then wait for them. Do not change their Python installation without asking.
2. Set the API key and URL
The SDK reads two environment variables:
TOOLVING_API_KEY: the user's Toolving account key. Sign up with Clerk, then create an API key in your account. The account page shows a new key once.TOOLVING_API_URL:https://toolving.com, unless the user's account page or operator gives another API URL.
If TOOLVING_API_KEY is already set, use it. Otherwise ask the user for it.
- Never print the key, write it into a log, or commit it to a repository.
- Ask the user where they want it kept: their shell profile, a
.envfile that git ignores, or their own secret manager. Show them the line before you write it. - Keep the key on the server. Never put it in browser code.
bash or zsh (Linux, macOS, WSL): add to ~/.bashrc or ~/.zshrc (macOS uses zsh by default), then open a new shell or source the file:
export TOOLVING_API_URL=https://toolving.com
export TOOLVING_API_KEY='<the key>'
fish: run once; fish keeps universal variables across sessions:
set -Ux TOOLVING_API_URL https://toolving.com
set -Ux TOOLVING_API_KEY '<the key>'
Windows PowerShell: store them for the user account, then open a new terminal (programs that are already running do not see the change):
[Environment]::SetEnvironmentVariable('TOOLVING_API_URL', 'https://toolving.com', 'User')
[Environment]::SetEnvironmentVariable('TOOLVING_API_KEY', '<the key>', 'User')
For the current PowerShell session only, use $env:TOOLVING_API_KEY = '<the key>'.
WSL: WSL does not see Windows user variables. Set the key in the WSL shell profile as for bash or zsh above.
3. Install the SDK
The installer downloads the newest SDK release for this deployment, checks its SHA-256, and installs it with the Python tooling the user already has. It takes the first of these that applies, and prints which one it used:
- an active virtual environment, then an active conda environment;
- a Poetry, PDM or uv project in the current directory, when that tool is installed (for uv, once the project has a
.venv). It installs into the project's environment and leavespyproject.tomlunchanged; uv tool install, thenpipx install. These install the SDK's commands in their own environment, but a program can onlyimport toolvingfrom an environment it is installed in;pip install --userwith the user's Python, when that Python accepts installs (it is not marked externally managed, as Debian, Ubuntu and Homebrew Pythons are).
It never creates a virtual environment, installs a package manager, or overrides an externally managed Python. If nothing applies, it stops and says why. After installing the SDK it installs the toolving-conceiver agent skill (step 4) for the agent hosts it finds; set TOOLVING_SKILL=0 to skip that. Run it from the project directory, with the project's environment active if it has one, so that your program can import the SDK.
Linux, macOS and WSL
curl -fsSL https://toolving.com/install.sh | sh
Windows PowerShell
irm https://toolving.com/install.ps1 | iex
To install a particular version, set TOOLVING_VERSION first: curl -fsSL https://toolving.com/install.sh | TOOLVING_VERSION=0.16.2 sh, or in PowerShell $env:TOOLVING_VERSION = '0.16.2' before the irm line. To pick the Python, set PYTHON the same way to its path.
The current release is SDK 0.16.2. You can also install its wheel from the public Toolving release yourself with the project's own tool; check it against the SHA-256 on the downloads page.
With pip install --user, uv tool install or pipx install, the SDK's commands (toolving-skill, toolving-playground, toolving-inspector) go into the user's scripts folder: ~/.local/bin on Linux and WSL, or the folder pip names in its warning (... is not on PATH). That folder is often not on PATH, so toolving-skill is "command not found". That does not mean the install failed. Use python -m toolving.skill, with the Python the SDK was installed into, instead of toolving-skill, as step 4 does. Add the folder to PATH only if the user asks; it is their shell profile.
If the installer stops:
Python 3.10 or newer is requiredorPython not found: run it again withPYTHONset to a newer Python, or ask the user to install one.no virtualenv, conda env, uv or pipx was found: the user's Python is externally managed or has no pip, and there is no other tool to install with. Ask the user which environment the project should use (or whether to install uv or pipx). Activate it and run the installer again. Do not pass--break-system-packages.- It used
uv tool installorpipx installbut the project needs toimport toolving: activate the project's environment and run the installer again. checksum mismatch: stop and tell the user. Do not install the file by hand.
Use a release that has ConceiverClient (0.12.0 or later; this page is written for 0.16.x). Older wheels on the downloads page may only have LearnerClient, which targets the earlier API.
4. Install the agent skill
The SDK (0.15.0 and later) ships the toolving-conceiver skill: how to teach Conceiver each kind of task, how to read its confidence and evidence, how to correct it, and what it does not do. Install it so that you, and any agent the user runs later, have it in every session.
The installer in step 3 already ran this for the hosts it found. Run it yourself with the Python the SDK was installed into, to check or to add a host:
python -m toolving.skill install
It writes toolving-conceiver/SKILL.md into the skills folder of each agent host it finds, and always into ~/.agents/skills, which Pi, Codex and other hosts read:
| Host | User skills folder | With --project |
|---|---|---|
| Claude Code | ~/.claude/skills |
.claude/skills |
| Codex | ~/.codex/skills |
.agents/skills |
| Pi | ~/.pi/agent/skills |
.pi/skills |
| Others | ~/.agents/skills |
.agents/skills |
On Windows ~ is %USERPROFILE%. It prints each file it wrote.
- To install for one host:
python -m toolving.skill install --host claude-code(orcodex,pi,agents). - To install into this project only, for everyone who works in it: add
--project. - If you run in another harness, find the folder it loads skills from and pass it:
python -m toolving.skill install --dir <that folder>. If your harness has no skills, read the skill directly withpython -m toolving.skill print, or keephttps://toolving.com/teaching.mdas a reference. - An existing
toolving-conceiver/SKILL.mdthat this command did not write is left alone; it saysskipped. Ask the user before passing--force. No module named toolving.skill: the installed SDK is older than 0.15.0. Run the installer in step 3 again.
Skills are loaded when a session starts: tell the user to restart their agent host, or start a new session, to load it. Until then, read it with python -m toolving.skill print.
5. Check the setup
Run this with the Python the installer used (inside a uv, Poetry or PDM project, prefix it with uv run, poetry run or pdm run). It only reads the model list. It does not teach or query.
Linux, macOS and WSL
python3 -c "import os; from toolving import ConceiverClient; c = ConceiverClient(os.environ['TOOLVING_API_URL'], os.environ['TOOLVING_API_KEY']); print([m['id'] for m in c.models()['models']])"
Windows PowerShell
python -c "import os; from toolving import ConceiverClient; c = ConceiverClient(os.environ['TOOLVING_API_URL'], os.environ['TOOLVING_API_KEY']); print([m['id'] for m in c.models()['models']])"
It should print ['language', 'numbers']: language learns whatever you teach it, and numbers is a ready-made calculator (step 6). There is no separate json model; teach JSON answers to a language instance as one line.
If it fails:
ModuleNotFoundError: No module named 'toolving': the SDK went into another Python. Run the check with the interpreter or environment the installer reported.KeyError: 'TOOLVING_API_KEY': the key is not in this shell's environment. On Windows, open a new terminal after setting a user variable; in WSL, set it in the WSL profile.ImportErrorforConceiverClient: an older wheel is installed. Run the installer again.ConceiverAPIErrorwith codeUNAUTHORIZED: the key is missing, wrong or revoked. Ask the user for a new key from their account page.- A connection error: check that
TOOLVING_API_URLishttps://toolving.comwith no path after it.
6. Create, teach, query and reap
Save this as toolving_check.py and run it with the same Python as step 5. It creates an instance, teaches it two examples, asks one taught and two new questions, and releases the instance:
import os
from toolving import ConceiverClient
with ConceiverClient(os.environ["TOOLVING_API_URL"], os.environ["TOOLVING_API_KEY"]) as client:
instance = client.create()
instance.teach("create account alice", "createAccount(alice)")
instance.teach("create account bob", "createAccount(bob)")
for question in ("create account alice", "create account carol", "what colour is the sky"):
prediction = instance.query(question)
if prediction.status == "ANSWER":
print(question, "->", prediction.text, f"({prediction.confidence})")
else:
print(question, "-> no answer yet")
retirement = instance.reap()
print("reaped, learning kept:", retirement.persisted)
It prints something like:
create account alice -> createAccount(alice) (hypothesis)
create account carol -> createAccount(carol) (confident)
what colour is the sky -> no answer yet
reaped, learning kept: True
How to read a result:
ANSWER:textis Conceiver's best guess, andconfidenceis the level of evidence behind it:hypothesis,confident,highly confidentorambiguous. The level is how many times that answer was given or confirmed, minus how many times it was corrected away: one ishypothesis, twoconfident, three or morehighly confident; level for and against isambiguous. These are evidence counts, not probabilities; whether to use an answer is up to your program. Above,create account alicewas taught once, so it is ahypothesis; the patterncreate account <name>has two examples with two different names in the slot, socarolcomes backconfident. An input that fits a pattern in a way no example has shown stays ahypothesis: a new word in a slot that has only ever held one word, a value of several words where only single words were taught, a repeated word. Results from Conceiver 1.x instances may sayhigh.UNRESOLVED: nothing taught fits. There is no answer, onlyevidence.markdownexplaining why. Pass that to an LLM or a person, then teach the right answer. Do not treat it as an answer.
Matching is by exact word. Taught delete file report -> rm(report) and delete file notes -> rm(notes), the questions remove file report (a synonym), Delete file report (a capital letter) and please delete file report (an extra word in front) are all UNRESOLVED. An extra word at the end is worse: delete file report please answers rm(report please) as a hypothesis, because the last slot takes the rest of the line. Normalise the user's text in your program before you query (case, filler words), or teach each phrasing your users type.
Teaching and querying take one line of text per question and per answer. The teaching guide shows how to teach each kind of task, with tested examples, and what Conceiver does not do yet. Without account storage, reap() discards what the instance learned; use instance.training_sequence() first to copy it as text. With storage, persisted is true and a later instance can load it (see Python SDK).
Arithmetic: the numbers model
If the user's program needs arithmetic, create a numbers instance instead of teaching one. It comes already taught, as a basic calculator:
with ConceiverClient(os.environ["TOOLVING_API_URL"], os.environ["TOOLVING_API_KEY"]) as client:
calc = client.create(model="numbers")
for question in ("1234 plus 4321", "-5 + 3", "10 / 4", "300 compared to 299", "1 + 2 * 3"):
p = calc.query(question)
print(question, "->", p.text if p.status == "ANSWER" else "UNRESOLVED")
calc.reap()
It prints:
1234 plus 4321 -> 5555
-5 + 3 -> -2
10 / 4 -> 2.5
300 compared to 299 -> greater
1 + 2 * 3 -> UNRESOLVED
Ask one operation per question, written <number> <operation> <number>. Anything else, such as number words or other words around the expression, comes back UNRESOLVED. The Python SDK reference lists what it handles and what it declines.
7. Handle errors
Every API error raises ConceiverAPIError with status, code, retryable and operation_id. Check retryable before you repeat anything:
| Error | What it means | What to do |
|---|---|---|
401 UNAUTHORIZED |
The key is missing, wrong or revoked. | Ask the user for a new key. |
409 INSTANCE_INACTIVE |
The instance has retired. | Create a new instance with client.create(). Do not retry on the old one. |
422 RUNTIME_OPERATION_REJECTED |
Conceiver could not carry out this operation; the message gives its reason. It has failed for good, and nothing was charged. | Do not retry: the same key returns the same error. Change the input or skip it. The instance stays usable. |
409 MODEL_SIZE_LIMIT_REACHED |
This model has reached its maximum size. The operation was not applied and nothing was charged. Upgrading account storage does not change this limit. | Continue with a new model from client.create(). Sending the same call again with the same key tries it again. |
402 STORAGE_UPGRADE_REQUIRED |
The account's storage is full or not enabled. The operation was not applied and nothing was charged. | Tell the user: the error carries a purchase_url. After storage is expanded, send the same call again with the same key. |
422 INVALID_REQUEST |
The input breaks the API contract, for example a question with a line break. | Fix the input. |
| 409 with a reused key | The same key was sent with different content. |
Use a new key for a new request. |
503 with an operation_id, retryable true |
The request was accepted but the response was lost. | Repeat the same call with the same key, or read client.operation(operation_id). |
The key argument identifies an operation. The SDK makes one when you leave it out. Pass your own when you may need to recover a request, and reuse it only to repeat that same request.
8. Build an app
Build and run one example app now, before you report. This is the last setup step: do it without asking the user first.
- Fetch https://toolving.com/docs/examples.md and read it. Each section there is a small, complete app with the examples it teaches and the output it printed.
- Pick the app closest to what the user asked for. If they did not name a use case, build Teach an operation (
operation.py). - Copy that app into the user's project exactly as the page gives it, with its own examples. Do not change its examples or invent new ones.
- Run it with the environment from step 2 (
python operation.py, orpy -3 operation.pyin Windows PowerShell). Compare what it prints with the page's "It prints" block, and keep the output for step 9.
| App | What it does |
|---|---|
| Teach its first words | Recalls exact answers |
| Teach an operation | Turns a command into a JSON action |
| Build a workflow | Expands a request into steps, and each step into an action |
| Correct an answer | Moves an answer when someone corrects it, and routes two cases by one word |
| Workflow planner | Turns an onboarding request into a tool-call plan |
| Records desk | Decides where a record is filed |
| Invoice extractor | Pulls fields from an invoice line into a JSON record |
If the run fails, fix the cause with step 7 and run it again. Then, in step 9, offer to adapt the app to the user's own data. When they say yes, ask them for at least two real examples of their inputs and the outputs they want, replace the app's examples with theirs, and run it again to check the answers. Do not invent their examples.
9. Tell the user what you did
Report in a few lines:
- the system and shell you used, and which Python or environment has the SDK, with its version (
python -m pip show toolving,uv pip show toolving,poetry show toolvingorpdm show toolving); - where the key is kept (not the key itself);
- where the
toolving-conceiverskill was installed (the files step 4 printed), and that restarting their agent host loads it; - that the checks in steps 5 and 6 passed;
- the app you built and ran in step 8, with what it printed, and an offer to adapt it to their own examples.
Every docs page is also plain Markdown for agents: add .md to its address, as in https://toolving.com/docs/sdk.md.
Example apps · Teaching guide · Python SDK reference · HTTP API · Keys, credits and plans