Skip to content

Commit af8327d

Browse files
committed
initial creation of link labeling agent example
1 parent ae23eea commit af8327d

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

examples/linkTitler

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/java --enable-native-access=ALL-UNNAMED -Dtools.permissions.default=allow --class-path=../zsmith/zbo/zsmith.jar:./zsmith/zbo/lightmetal.jar --source 25
2+
3+
import airhacks.zsmith.agent.boundary.Agent;
4+
import airhacks.zsmith.tools.boundary.Tools;
5+
6+
void main() {
7+
8+
var linkTitler = new Agent("linkTitler", """
9+
You turn a list of links into an annotated "link - description" list.
10+
11+
1. 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".
15+
3. Build a plain-text list, one entry per line, formatted exactly as:
16+
<link> - <short description>
17+
Preserve the original order of the links.
18+
4. Use the write_clipboard tool to write the finished list back to the
19+
clipboard.
20+
21+
Be concise. Keep each description to a handful of words.
22+
""")
23+
.withTools(Tools.READ_CLIPBOARD, Tools.FETCH_URL, Tools.WRITE_CLIPBOARD)
24+
.withMaxIterations(40);
25+
26+
IO.println(linkTitler.act());
27+
}

0 commit comments

Comments
 (0)