summaryrefslogtreecommitdiff
path: root/libpanto/src/tool.zig
diff options
context:
space:
mode:
Diffstat (limited to 'libpanto/src/tool.zig')
-rw-r--r--libpanto/src/tool.zig17
1 files changed, 12 insertions, 5 deletions
diff --git a/libpanto/src/tool.zig b/libpanto/src/tool.zig
index c912099..60a7736 100644
--- a/libpanto/src/tool.zig
+++ b/libpanto/src/tool.zig
@@ -84,11 +84,18 @@ pub const Tool = struct {
/// agent takes ownership and frees the slice and every part (see
/// `freeResultParts`).
///
- /// Returning an error aborts the current turn. The agent surfaces
- /// the error to the user. Native tool implementations are
- /// responsible for catching their own panics — a panic in `invoke`
- /// will crash the process. Adapters that bridge to safer languages
- /// (Lua, Python, Go) should convert panics/exceptions into errors.
+ /// Returning an error normally becomes a model-visible error
+ /// `ToolResult`: the agent synthesizes an error result for this
+ /// call (and keeps the matching `ToolResult` for every other call
+ /// in the batch), then lets the model continue so it can correct
+ /// arguments, try another tool, or explain the failure. Only hard
+ /// host failures (`error.Canceled`, `error.OutOfMemory`) abort the
+ /// whole turn and propagate to the embedder.
+ ///
+ /// Native tool implementations are responsible for catching their
+ /// own panics — a panic in `invoke` will crash the process.
+ /// Adapters that bridge to safer languages (Lua, Python, Go) should
+ /// convert panics/exceptions into errors.
invoke: *const fn (
ctx: *anyopaque,
input: []const u8,