One tool set, three loops
Define the tools and the prompt once, as plain functions, and let each framework wrap them. The frameworks then differ only in the machinery around the same agent.
Study first
- What a framework adds to the loop you wrote on Day 11: a shape for state, control flow you can draw, and handoffs between agents. It also brings tracing and checkpoints you do not write yourself. In return, its state shape ends up in your code, its upgrades bring churn, and you debug through its abstractions.
- The 4 tools are
web_search,read_url,save_findingandwrite_report. WhenBRAVE_SEARCH_KEYis set,web_searchsearches the web, and otherwise it searches WorkBot's knowledge base (Day 13, undercontent/knowledge/).read_urlreads either kind of address. The findings and the report go to a notebook, a small object the run owns. Each framework's own state reads from the notebook, so the framework's state and the tools stay in step. Anthropic's post on writing tools for agents explains why a few well-described tools beat many, and why each result should be short and readable. - When to skip the framework: for a single-agent tool loop the size of Day 11's, 90 lines. Day 15's analyst runs on that loop and stays as it is. Anthropic gives the same advice on when and how to use frameworks. Start with the model's API, because a framework's layers can hide the prompts and responses.
Build
- Write
src/lib/frameworks/tools.ts. Build the 4 tools with Day 12'stool()helper, add aNotebookthat holds the findings and the report, and address a document asknowledge://section/slug. - Write
src/lib/frameworks/researcher.ts, with the instructions, the step limit, and the result shape every framework returns. The result holds the report, the findings, the tool calls, the usage, the dollars and the milliseconds. - Write the 5 questions in
content/eval/topics.json, all of which the knowledge base can answer.
Done when
- The tools' tests pass. With no key, a search finds a document and gives an address that
read_urlreads, and a finding and a report land in the notebook.
Technical notes
read_urlreturns a document with its title as the heading, and the model then cites that title as the source.- One function,
costOf, prices every framework's usage with the prices per model fromsrc/lib/providers.ts(Day 19), so the dollars column compares like with like. The Claude Agent SDK also reports its own total, which checks the arithmetic.


