Skip to content

Commit 00373bf

Browse files
committed
README update with a calculator example
1 parent 4f0aca1 commit 00373bf

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,35 @@ void main() {
186186

187187
No package declaration, no class wrapper — Java 25 implicit classes keep the script minimal. Install system-wide by copying the jar and script to a PATH directory, adjusting the `--class-path` accordingly.
188188

189+
A minimal calculator agent — see [`examples/calculator`](examples/calculator):
190+
191+
```java
192+
#!/usr/bin/java --class-path=../zsmith/zbo/zsmith.jar --source 25
193+
194+
import airhacks.zsmith.agent.boundary.Agent;
195+
import airhacks.zsmith.tools.boundary.Tools;
196+
197+
void main() {
198+
199+
var calculator = new Agent("calculator", """
200+
You are a calculator assistant.
201+
1. Ask the user for a math expression.
202+
2. Use the calculator tool to evaluate it.
203+
3. Show the result to the user.
204+
4. Loop until the user types 'quit'.
205+
""")
206+
.withTools(Tools.USER_QUESTION, Tools.USER_MESSAGE, Tools.CALCULATOR);
207+
208+
calculator.act();
209+
}
210+
```
211+
212+
Run it directly:
213+
214+
```bash
215+
./examples/calculator
216+
```
217+
189218
## Skills
190219

191220
Skills are reusable prompt snippets stored as `SKILL.md` files. Each skill uses frontmatter for metadata:

0 commit comments

Comments
 (0)