What a tool returns
Normally the AI gets whatever the tool printed. You can change that in the pack file.
Output
| output = | The AI gets |
|---|---|
| "text" (the default) | What the program printed. If it printed nothing, its error output; if neither, "Done (no output)." |
| "json" | The printed JSON, as data the AI can use, and as text. |
| "image" | A picture the tool saved, which the AI can look at. |
| "file" | The contents of a file the tool saved. |
For images and files, add output_file = "png" (or another extension) and save to {{ output_path }} in your
script. Without it, the last line the tool prints is taken as the file's path.
Format
format turns the result into the text you want the AI to see. It can use the parameters and:
- for programs and scripts:
stdout,stderr,exit_code, andjsonwhen the output is JSON - for web requests:
status,bodyandjson
format = "{{ json.full_name }}: {{ json.stargazers_count }} stars"
Errors
A program that ends with an error code, or a web request that gets an error reply, returns an error to the AI with
what went wrong, so it can tell you or try something else. ok_codes = [0, 1] lists exit codes that count as
success.
max_output limits how much is kept (100,000 bytes by default). Longer output is cut, with a note.