@@ -5,22 +5,39 @@ import airhacks.zsmith.tools.boundary.Tools;
55
66void main() {
77
8+ var linkLabeler = new Agent("link_labeler", """
9+ You describe the intent of a single web page.
10+
11+ Given one URL, use the fetch_url tool to load it, then return a short
12+ description of what the page is for — its intent, not its title. Capture
13+ why someone would visit it (e.g. "JDK download page", "Quarkus REST
14+ tutorial", "personal blog about Java performance").
15+
16+ Return ONLY the description: a handful of words, no URL, no quotes, no
17+ trailing punctuation. If the page is unreachable, return exactly:
18+ unreachable
19+ """)
20+ .withTool(Tools.FETCH_URL)
21+ .withMaxIterations(10);
22+
823var linkTitler = new Agent("linkTitler", """
924You turn a list of links into an annotated "link - description" list.
1025
11261. Use the read_clipboard tool to read the links (one URL per line).
12- 2. For every link, use the fetch_url tool to load the page and derive a
13- short, descriptive title (prefer the page's <title>, condensed to a
14- few words). If a page is unreachable, describe it as "unreachable".
27+ 2. For every link, in order, use the delegate_to_link_labeler tool with
28+ that single URL to obtain a short description of the page's intent.
29+ Do not fetch pages yourself — delegation keeps page content out of
30+ your context.
15313. Build a plain-text list, one entry per line, formatted exactly as:
16- <link> - <short description>
32+ <link> - <description>
1733 Preserve the original order of the links.
18344. Use the write_clipboard tool to write the finished list back to the
1935 clipboard.
2036
21- Be concise. Keep each description to a handful of words.
37+ Be concise.
2238""")
23- .withTools(Tools.READ_CLIPBOARD, Tools.FETCH_URL, Tools.WRITE_CLIPBOARD)
39+ .withTools(Tools.READ_CLIPBOARD, Tools.WRITE_CLIPBOARD)
40+ .withSubAgent(linkLabeler)
2441.withMaxIterations(40);
2542
2643IO.println(linkTitler.act());
0 commit comments