developers · guide · shipped
guide-10
01about
Chapter 10 of 12 -- Write a tool pack, check it without running it, load it the way an agent will, and build bytes anyone can verify.
About 20 minutes. Read online: https://aitherium.github.io/awknowledge/path/10-build-a-pack.html
A pack is a folder
In chapter 5 you installed a pack someone else built. This chapter is the other side: you write one. A tool pack is an ordinary folder with three things in it:
.toolpack.yaml— the manifest: an id, a version, a one-line description__init__.py— aregister(registry)function that hands your tools to the agenttools.py— the tools themselves, plain Python functions
The docstring and the type hints of each function ARE what the agent reads to decide when to call it, so write them for the model: say what the tool returns and when it is the right one.
Your id is your namespace
Pack ids look like yourname.weather. The part before the dot is yours; names that start
with aither or adk belong to the platform and are refused, so a community pack can never
shadow one the platform ships.
Four verbs, one loop
adk pack has four author verbs, and each one answers a single question:
| verb | question it answers |
|---|---|
new | what does a working pack look like? |
validate | is the folder correct — without running any of its code? |
dev | does it load the way an agent will load it, and which tools does it expose? |
build | what exact bytes am I publishing? |
validate never imports your code, so you can run it safely on a pack you downloaded from
a stranger. It also looks for anything shaped like an API key and reports the file and line
without printing the value. dev is the one step that runs your code, and it says so.
Reproducible bytes
build writes a .tar.gz and its sha256. The archive has sorted entries and zeroed
timestamps, so the same source always produces the same bytes. Anyone who rebuilds your
tagged source gets your digest, which is how a stranger can trust a pack they did not write.
DO
- $ adk pack new yourname.weather you should see: created <path>/yourname.weather, then the next two commands to run if not: If it says the id is reserved, use a namespace of your own, like your GitHub handle.
- $ adk pack validate yourname.weather you should see: OK yourname.weather 0.1.0 ... all clean if not: Each PKA code names the file or field to fix. Fix it and run validate again.
- $ adk pack dev yourname.weather you should see: OK yourname.weather: 1 tool(s) registered - weather_echo if not: 0 tools means TOOL_NAMES in init.py does not name the functions in tools.py.
- $ adk pack build yourname.weather you should see: built <path>/yourname.weather-0.1.0.tar.gz and a sha256 if not: build refuses a pack that does not validate - run validate and fix what it lists.
done when: $ adk pack validate yourname.weather you should see: OK yourname.weather 0.1.0
WHAT YOU LEARNED
- A tool pack is a folder - a manifest, a register() function and plain Python tools.
- validate never runs the pack's code; dev is the one step that does, and it loads the pack exactly as an agent will.
- build is reproducible, so a digest you publish can be checked by anyone who rebuilds your source.