Share the knowledge tools
The pipeline's agents need the same knowledge base tools as Day 11's investigation agent, so you move those tools into a module of their own before anything else uses them.
Study first
- Look again at the
Tooltype and thetool()helper from Day 7. The Agent SDK builds its tools from a Zod object schema's.shape, the map of its fields.
Build
- Write
src/lib/knowledge-tools.tswithsearchKnowledgeBaseandreadPolicy, built with thetool()helper, and make the investigation agent import them instead of defining them. - Change the
Tooltype'sinputto aZodObject, because the Agent SDK'stool()takes the schema's.shape.
Done when
pnpm testpasses unchanged, and the investigation agent's tool list is 2 definitions shorter.


